Ich erzeug über folgende Funktion Thumbnails für ne Screenshotgallerie. Wodran liegt es das die Bilder teilweise ihre Farbe verlieren und wie kann ich das beheben.
Online zu bewundern unter:
http://www.xtremenintendo.de/index.p...hot/screenshot
MfG
mnhg
PHP Code:
function Thumb ($GIMG)
{
global $IMAGE_WIDTH;
global $IMAGE_HEIGHT;
$info = getimagesize($GIMG,$info2);
if (($info[0]>$IMAGE_WIDTH) || ($info[1]>$IMAGE_HEIGHT))
{
if (file_exists("images/tmb/tmb_".basename($GIMG)))
{
$IMG="images/tmb/tmb_".basename($GIMG);
}
else
{
if ($info[0]>$info[1])
{
$tmbscale=($info[0]/$IMAGE_WIDTH);
$tmbwidth=$IMAGE_WIDTH;
$tmbheight=($info[1]/$tmbscale);
}
else
{
$tmbscale=($info[1]/$IMAGE_HEIGHT);
$tmbheight=$IMAGE_HEIGHT;
$tmbwidth=($info[0]/$tmbscale);
}
switch ($info[2])
{
case 2:
$image = imagecreatefromjpeg($GIMG);
$image1 = imagecreate($tmbwidth,$tmbheight);
$farbe_body=imagecolorallocate($image1,255,255,255);
imagecopyresized($image1, $image, 0,0, 0,0,$tmbwidth,$tmbheight, $info[0],$info[1]);
imagejpeg($image1,"images/tmb/tmb_".basename($GIMG));
$IMG="images/tmb/tmb_".basename($GIMG);
break;
case 3:
$image = imagecreatefrompng($GIMG);
$image1 = imagecreate($tmbwidth,$tmbheight);
$farbe_body=imagecolorallocate($image1,255,255,255);
imagecopyresized($image1, $image, 0,0, 0,0,$tmbwidth,$tmbheight, $info[0],$info[1]);
imagepng($image1,"images/tmb/tmb_".basename($GIMG));
$IMG="images/tmb/tmb_".basename($GIMG);
break;
case 1:
$image = imagecreatefromgif($GIMG);
$image1 = imagecreate($tmbwidth,$tmbheight);
$farbe_body=imagecolorallocate($image1,255,255,255);
imagecopyresized($image1, $image, 0,0, 0,0,$tmbwidth,$tmbheight, $info[0],$info[1]);
imagegif($image1,"images/tmb/tmb_".basename($GIMG));
$IMG="images/tmb/tmb_".basename($GIMG);
break;
}
}
}
else
{
$IMG=$GIMG;
}
echo ' <a href=javascript:popupw=window.open("'.$GIMG.'","Screenshot",
"dependent=no,height='.($info[1]+20).',hotkeys=no,left=0,location=no,menubar=no,
resizable=yes,scrollbars=no,status=no,toolbar=no,top=0,width='.($info[0]+20).'");popupw.focus();><img src='.$IMG.' border=0></a> ';
}
http://www.xtremenintendo.de/index.p...hot/screenshot
MfG
mnhg
Comment