note 69702 added to ref.outcontrol
| From: | trucex | Date: | Sat, 16 Sep 2006 09:08:51 +0000 |
| Subject: | note 69702 added to ref.outcontrol | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117240@lists.php.net to get a copy of this message | ||
Unfortunately, the PHP guys didn't build support into any of the image output functions to
return the image instead of outputting it.
Fortunately, we have output buffering to fix that.
<?
$im = imagecreatetruecolor(200, 200);
// Other image functions here...
ob_start();
imagepng($im);
$imageData = ob_get_contents();
ob_clean();
?>
You can now use the $imageData variable to either create another GD image, save it, put it in a
database, make modifications to the binary, or output it to the user. You can easily check the size
of it as well without having to access the disk...just use strlen();
----
Server IP: 64.71.164.2
Probable Submitter: 68.84.197.69
----
Manual Page -- http://www.php.net/manual/en/ref.outcontrol.php
Edit -- https://master.php.net/note/edit/69702
Del: integrated -- https://master.php.net/note/delete/69702/integrated
Del: useless -- https://master.php.net/note/delete/69702/useless
Del: bad code -- https://master.php.net/note/delete/69702/bad+code
Del: spam -- https://master.php.net/note/delete/69702/spam
Del: non-english -- https://master.php.net/note/delete/69702/non-english
Del: in docs -- https://master.php.net/note/delete/69702/in+docs
Del: other reasons-- https://master.php.net/note/delete/69702
Reject -- https://master.php.net/note/reject/69702
Search -- https://master.php.net/manage/user-notes.php