Is there any way to export the PNG data that's been created using the GD library's imagecreatefrompng directly to a variable, rather than echoing it or saving it to a file?
Asked
Active
Viewed 541 times
2
-
My guess is that you can use `ob_start` and family to catch the output when echoing the file – WizKid Jun 02 '14 at 04:14
1 Answers
3
You can use ob_start
and family to catch the output when you echoing the file. So it would look something like this:
ob_start();
imagepng($img);
$image_content = ob_get_clean();

WizKid
- 4,888
- 2
- 23
- 23