tags:

views:

73

answers:

1

I have a GD image resource created from imagecreatefromstring. After some image operations, I want to convert it back to binary data. How would I do this? Can't see any functions in the manual...

+1  A: 

Use imagejpeg, imagepng, or similar. Use output buffering if you want to dump the result to a string, rather than a file:

ob_start();
imagejpeg($im);
$image_string = ob_get_contents();
ob_end_flush();
Adam Backstrom