Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Resizing Gif Problems


matthewamzn - 5:08 pm on Apr 5, 2007 (gmt 0)


I have a script that is resizing gif images. There is a problem if the gif has a trasparent background, the background turns black. Also any animation in the gif is lost. Any suggestions? This is a portion of the code:

$thumb=imagecreatetruecolor($w1,$h1);
$new=imagecreatefromgif($imagepath);
for($i=0;$i<256;$i++) imagecolorallocate($thumb,$i,$i,$i);
imagecopyresampled($thumb,$new,0,0,0,0,$w1,$h1,$w0,$h0);
imagejpeg($thumb,$thumbpath);
ImageDestroy($new);
ImageDestroy($thumb);


Thread source:: http://www.webmasterworld.com/php/3303453.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com