question about GD and colors

From: Date: Mon, 27 Jan 2003 16:15:31 +0000
Subject: question about GD and colors
Groups: php.general 
Request: Send a blank email to php-general+get-133252@lists.php.net to get a copy of this message
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);

« previous php.general (#133252) next »