RE: [PHP] question about GD and colors
Hi I have the same Problem with the bundeled libary. I hade no time to fill in a bug report at bugs.php.net. Probably you could? regards Sebastian -Original Message- From: Jean-François Marseaut [mailto:[EMAIL PROTECTED]] Sent: Monday, January 27, 2003 5:16 PM To: [EMAIL PROTECTED] Subject: [PHP] question about GD and colors With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about GD and colors
Hi, question was answered yesterday on the list. there is a new function imagecreatetruecolor(). use this instead of imagecreate(). Regard, Philipp - Original Message - From: nospam [EMAIL PROTECTED] To: 'Jean-François Marseaut' [EMAIL PROTECTED] Cc: 'Php-General [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:48 PM Subject: RE: [PHP] question about GD and colors Hi I have the same Problem with the bundeled libary. I hade no time to fill in a bug report at bugs.php.net. Probably you could? regards Sebastian -Original Message- From: Jean-François Marseaut [mailto:[EMAIL PROTECTED]] Sent: Monday, January 27, 2003 5:16 PM To: [EMAIL PROTECTED] Subject: [PHP] question about GD and colors With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about GD and colors
With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about GD and colors
Hi experienced the same problem with the new bundled version of GD. regards, philipp - Original Message - From: Jean-François Marseaut [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:15 PM Subject: [PHP] question about GD and colors With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about GD and colors
try imagecreatetruecolor() instead of imagecreate() - Original Message - From: Philipp [EMAIL PROTECTED] To: Jean-François Marseaut [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 27, 2003 4:21 PM Subject: Re: [PHP] question about GD and colors Hi experienced the same problem with the new bundled version of GD. regards, philipp - Original Message - From: Jean-François Marseaut [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:15 PM Subject: [PHP] question about GD and colors With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about GD and colors
Hi Adrian, thank you very much, that solved my problem. Regards, Philipp - Original Message - From: adrian [EMAIL PROTECTED] [EMAIL PROTECTED] To: Philipp [EMAIL PROTECTED]; Jean-François Marseaut [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 27, 2003 6:10 PM Subject: Re: [PHP] question about GD and colors try imagecreatetruecolor() instead of imagecreate() - Original Message - From: Philipp [EMAIL PROTECTED] To: Jean-François Marseaut [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 27, 2003 4:21 PM Subject: Re: [PHP] question about GD and colors Hi experienced the same problem with the new bundled version of GD. regards, philipp - Original Message - From: Jean-François Marseaut [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 27, 2003 5:15 PM Subject: [PHP] question about GD and colors With this script under, I get resized image in only 16 colors. with an old version of gd, I got 16 million colors images. Has someone a response ? ?PHP /*** file [string] - filename jpg w [int] - width / header(Content-type: image/png); $file = urldecode($file); $file = ../.$file; $infofile = getimagesize($file); $long = $infofile[1]; $haut = $infofile[0]; $type = $infofile[2]; if ($long$w) $w=$long; $ratio = $haut / $w; $h = $long / $ratio; if ($h$w) { $h = $w; $ratio = $long / $w; $w = $haut / $ratio; } $h = (int)$h; $dst_img = ImageCreate($w, $h); $background_color = ImageColorAllocate ($dst_img, 0, 0, 0); switch ($type) { case 1 : $src_img=ImageCreateFromGif($file); break; case 2 : $src_img=ImageCreateFromJpeg($file); break; case 3 : $src_img=ImageCreateFromPng($file); break; case 6 : $src_img=imagecreatefromwbmp($file); break; default : ImagePng($dst_img); } imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $w, $h, ImageSX($src_img), ImageSY($src_img)); imagepng($dst_img); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php