imagecopyresized - farverne ser forkerte ud
Hej... jeg har her en kode der skal resize et billede..Selve koden virker fint, men farverne ser helt forkerte ud?? Hvad er der galt?
sådan kommer mit billede til at se ud:
http://www.avansis.dk/newimage.jpg
her er min kode:
<?
$image_src = 'test.jpg';
$max_width = 300;
$max_height = 400;
$size = getimagesize($image_src);
$width_src = $size[0];
$height_src = $size[1];
$ext_src = $size[2];
$width_org = $width_src;
$height_org = $height_src;
if($width_src > $max_width)
{
$multiply[0] = $width_src / $max_width;
$width_src = $width_src / $multiply[0];
$height_src = $height_src / $multiply[0];
}
if($height_src > $max_height)
{
$multiply[1] = $height_src / $max_height;
$width_src = $width_src / $multiply[1];
$height_src = $height_src / $multiply[1];
}
if(!$multiply)
{
echo 'Billedet overholder reglerne';
exit;
}
echo $width_src.'x'.$height_src;
$image = imagecreate($width_src, $height_src);
imagecolorallocate($image, 255, 0, 255);
$src = imagecreatefromjpeg($image_src);
imagecopyresized($image, $src, 0, 0, 0, 0, $width_src, $height_src, $width_org, $height_org);
imagejpeg($image, 'newimage.jpg');
imagedestroy($image);
?>
