note 67933 added to function.imagegif
| From: | rokfaith at gmail dot com | Date: | Thu, 06 Jul 2006 22:34:39 +0000 |
| Subject: | note 67933 added to function.imagegif | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114521@lists.php.net to get a copy of this message | ||
to create an animated gif with gifsicle, but without storing temporary images on disk:
<?
$cmd = 'gifsicle --loop -O1 --multifile --delay 25 - > '.$outfile;
$desc = array(0 => array("pipe", "r"),1 => array("pipe",
"w"),2 => array("pipe", "w"));
$proc = proc_open($cmd, $desc, $pipes);
if (!is_resource($proc)) {
die('Unable to start gifsicle');
}
for ($frame=0; $frame<$total_frames; $frame++) {
$image = RenderFrame($frame);
ob_start();
imagegif($image);
fwrite($pipes[0], ob_get_contents());
ob_end_clean();
imagedestroy($image);
}
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($proc);
?>
just define $outfile and RenderFrame(), and that's it.
----
Server IP: 216.12.218.215
Probable Submitter: 193.95.249.86 (proxied: 194.152.23.195)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.imagegif.php
Edit -- http://master.php.net/note/edit/67933
Del: integrated -- http://master.php.net/note/delete/67933/integrated
Del: useless -- http://master.php.net/note/delete/67933/useless
Del: bad code -- http://master.php.net/note/delete/67933/bad+code
Del: spam -- http://master.php.net/note/delete/67933/spam
Del: non-english -- http://master.php.net/note/delete/67933/non-english
Del: in docs -- http://master.php.net/note/delete/67933/in+docs
Del: other reasons-- http://master.php.net/note/delete/67933
Reject -- http://master.php.net/note/reject/67933
Search -- http://master.php.net/manage/user-notes.php