problem generating thumbnail from a transparent gif
Posted: Wed Nov 29, 2006 1:48 am
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hello
i am trying to generate a thumbnail from a transparent gif image. now that the problem is my whole image is get filled by the objects colors. i have studied the function provided in phpgd but it is not working.
please help urgent!
The code i am using to achieve this is:Code: Select all
function imagecreatetruecolortransparent($x,$y)
{
$i = imagecreatetruecolor($x,$y);
//$b = imagecreatefromstring(base64_decode(blankpng()));//i have modified as i dont want any text to insert
imagealphablending($i,false);
imagesavealpha($i,true);
//imagecopyresized($i,$b,0,0,0,0,$x,$y,imagesx($b),imagesy($b));
return $i;
}
function thumbnail_builder($src_image = "",$src_image_dir = "",$dst_image_dir ="",$new_image = "")
{
if(exif_imagetype($src_image_dir.$src_image) == IMAGETYPE_GIF)
{
$im = imagecreatefromgif($src_image_dir.$src_image) or die("cant read image");
$dst_im = $this->imagecreatetruecolortransparent(50,51);
imagecopyresampled($dst_im,$im,0,0,0,0,50,51,imagesx($im),imagesy($im)) or die("cant resampled");
$dst_image_dir = $dst_image_dir.$new_image;
imagegif($dst_im,$dst_image_dir);
imagedestroy($im);
imagedestroy($dst_im);
}
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]