Re: [PHP-DB] Shrinking gifs.. .
Hello, i've got this in the comments: START emilus at galeria-m dot art dot pl (30-Sep-2004 10:02) To resize or copy image (gif [with gd=2.0.28] or png) with transparency. -Take current transparency color -create a new image with palette like old one and fill new image with transparent color -set transparent color -copy resized image $colorTransparent = imagecolortransparent($im); $im2 = imagecreate($new_w,$new_h); imagepalettecopy($im2,$im); imagefill($im2,0,0,$colorTransparent); imagecolortransparent($im2, $colorTransparent); imagecopyresized($im2,$im,0,0,0,0,$new_w,$new_h,$imsx,$imsy); START Thanks Martin for the tips.. Regards, Nadim Attari Martin Norland a écrit dans le message nikos wrote: Thank you Martin I install new gd, reconfigure php and now is running OK. But, it was a mass to realize that shortening gifs results to loss transparency(!). [snip] imagecolortransparent() That function will set the transparent color in an image (only one per image). If you read the description carefully it says that it will return the existing one if you don't specify a new color... so: $transparent_color = imagecolortransparent($uploaded_img); imagecolortransparent($thumbnail, $transparent_color); That should get you and Nadim what you're looking for, assuming things work as promised (I've never used it myself). If you need to work with pngs and the likes, imagecolorexactalpha / imagecolorclosestalpha - requires GD 2.01 and PHP 4.0.6 (imagecolorallocatealpha requires PHP 4.3.2 though, oddly enough) cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Shrinking gifs.
Thank you Martin I install new gd, reconfigure php and now is running OK. But, it was a mass to realize that shortening gifs results to loss transparency(!). So I turn them all to jpegs and use the ImageCreateFromJPG instead. My code looks like this: ? $ph='photos/'.$photo; $imgReal = imagecreatefromjpeg($ph); $x = ImagesX($imgReal); $y = ImagesY($imgReal); $newX=$x*0.50; $newY=$y*0.50; $img = ImageCreate($newX,$newY); ImageCopyResized($img, $imgReal, 0, 0, 0, 0, $newX, $newY, $x, $y); ImageJPEG($img); header(Content-Type: {$img_type}); echo $img; ? -Original Message- From: Martin Norland [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 21, 2005 4:31 PM To: PHP-mailist (PHP-mailist) Subject: Re: [PHP-DB] Shrinking gifs. . nikos wrote: Hello list I'd like to make a thumbnaile list using some gifs. I use the following code but I got error (Call to undefined function: imagecreatefromgif() ). Does anybody knows what's wrong? [snip] RH-9 Linux Apache httpd-2.0.40-21.11 PHP Version 4.3.11 gd-1.8.4-11 gif support was removed from gd in 1.6*. It was re-added in 2.0.28. This is all due to the Unisys patent on the LZW compression that gifs use. short answer - you just don't have support for making gifs, it was a licensing issue at the time the software you're using was released/packaged. Upgrade gd. * funny, since gd stood for 'gif draw' originally. cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shrinking gifs.
nikos a écrit dans le message But, it was a mass to realize that shortening gifs results to loss transparency(!). Yea TRUE ! The background is black ! You will get the same result when creating PNG thumbnails ! In fact imagecreate and imagecreatetruecolor both [quoted from the manual] ... returns an image identifier representing a BLACK image of size x_size by y_size. Question: Does anyone have a script / piece of code that keeps transparency after creating the thumbnail ? Regards, Nadim Attari -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shrinking gifs.. .
nikos wrote: Thank you Martin I install new gd, reconfigure php and now is running OK. But, it was a mass to realize that shortening gifs results to loss transparency(!). [snip] imagecolortransparent() That function will set the transparent color in an image (only one per image). If you read the description carefully it says that it will return the existing one if you don't specify a new color... so: $transparent_color = imagecolortransparent($uploaded_img); imagecolortransparent($thumbnail, $transparent_color); That should get you and Nadim what you're looking for, assuming things work as promised (I've never used it myself). If you need to work with pngs and the likes, imagecolorexactalpha / imagecolorclosestalpha - requires GD 2.01 and PHP 4.0.6 (imagecolorallocatealpha requires PHP 4.3.2 though, oddly enough) cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Shrinking gifs
I'm afraid I dont know such command -Original Message- From: Darryl Steyn [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 21, 2005 2:50 PM To: nikos Subject: Re: [PHP-DB] Shrinking gifs afaik, you need to use imagemagik to resize a gif
Re: [PHP-DB] Shrinking gifs. .
nikos wrote: Hello list I'd like to make a thumbnaile list using some gifs. I use the following code but I got error (Call to undefined function: imagecreatefromgif() ). Does anybody knows what's wrong? [snip] RH-9 Linux Apache httpd-2.0.40-21.11 PHP Version 4.3.11 gd-1.8.4-11 gif support was removed from gd in 1.6*. It was re-added in 2.0.28. This is all due to the Unisys patent on the LZW compression that gifs use. short answer - you just don't have support for making gifs, it was a licensing issue at the time the software you're using was released/packaged. Upgrade gd. * funny, since gd stood for 'gif draw' originally. cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php