I am seeking to add a tracking pixel to my website which is 1Mb in size. Ideally this should be 1x1 px and minimize the amount of effort used to render in the browser.
We will be using this on our intranet to test the internet connection of website visitors.
<?php
# From https://github.com/mathiasbynens/small/blob/master/bmp.bmp
echo hex2bin('424d1e000000000000001a0000000c00000001000100010018000000ff00');
$chunk = 1000;
for ($i = 0; $i < 1000000; $i += $chunk) {
echo random_bytes($chunk);
}
However this file is invalid:
identify out.bmp
out.bmp BMP2 1x1 1x1+0+0 8-bit sRGB 1000030B 0.000u 0:00.003
identify: length and filesize do not match `out.bmp' @ warning/bmp.c/ReadBMPImage/834.
Is there a better way to send this garbage to the visitor?