You can use PHP's memory I / O stream to save the image and subsequently get the size in bytes.
What are you doing:
$img = imagecreatetruecolor(100,100); // do your processing here // now save file to memory imagejpeg($img, 'php://memory/temp.jpeg'); $size = filesize('php://memory/temp.jpeg');
You should now know the size
I do not know any (gd) method to get the size of the image resource.
Dennis haarbrink
source share