note 59199 added to function.imagegif
| From: | cascade at mylifesucks dot de | Date: | Tue, 29 Nov 2005 12:02:48 +0000 |
| Subject: | note 59199 added to function.imagegif | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99290@lists.php.net to get a copy of this message | ||
I would rather use gifsicle ( http://www.lcdf.org/gifsicle/ ) instead of convert. It runs
much faster with big animations. I got large animations with over 500 frames rendered where convert
was killed by my system because of memory consumption. And it contains pretty well optimization.
A sample gifsicle usage (not much optimized):
<?
// Sample gifsicle usage to create a scrolling text
$gifsicle = "/usr/local/bin/gifsicle"; # http://www.lcdf.org/gifsicle/
$time = time();
for ($rend_frame = 0; $rend_frame <= 26; $rend_frame++) {
$im = @imagecreatetruecolor(300, 20);
$background = imagecolorallocate($im, 0, 0, 100);
$red = imagecolorallocate($im, 255, 0, 0);
$filename = "/tmp/giftest_".$time."_".str_pad($rend_frame, 10,
"0", STR_PAD_LEFT).".gif";
$framefiles[] = $filename;
imagestring($im, 3, ($rend_frame * 15)-80, 3, "Animation rox", $red);
imagegif($im,$filename);
imagedestroy($im);
};
$outfile = "/tmp/giftest_".$time.".gif";
$cmd = "$gifsicle --loop -O1 --delay 25 /tmp/giftest_".$time."*> $outfile";
exec($cmd, $out, $err);
foreach ($framefiles as $framefile) {
if (file_exists($framefile)) unlink($framefile);
};
header('Content-type: image/gif');
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: inline; filename=test.gif');
header('Content-Length: '.@filesize($outfile));
readfile($outfile);
unlink($outfile);
?>
Or get patches from http://hyvatti.iki.fi/~jaakko/sw/ to be able to do it
all inside php...
----
Manual Page -- http://www.php.net/manual/en/function.imagegif.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59199
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59199&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59199&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59199&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59199&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59199&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59199&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59199&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59199&report=yes
Search -- http://master.php.net/manage/user-notes.php