I have a small script that creates a small png. This is the part i'm having trouble with...
PHP Code:
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
I've read that i need to add another header...
PHP Code:
header ('Content-length: size');
Judging by what i assume it should do, i've come up with this...
PHP Code:
$tmpfile = tempnam("/tmpdir", "img");
imagepng($img, $tmpfile);
header('Content-type: image/png');
header ('Content-length: filesize($tmpfile)');
imagedestroy($img);
But i'm guessing the header lines should come before imagepng and imagedestroy.
How do i get the file size of my png?