Image Funktion zeigt Bild nicht Richtig an

Hi, ich hab mir da jetzt einen Code zusammengeschrieben der auch funktioniert. Nur leider nicht so wie er soll. Er zeigt die Bilder in (glaube nur 256) Farben an ich möchte aber die beste Qualität erzielen. Kann wer den Fehler finden?

[code]$path = “” . $_FILES[“upfile”][“tmp_name”] . “”;
function createimage($width, $height){
$imgh = imagecreate($width, $height);
return $imgh;
}

if($path){

$height = 480;
$width = 640;

$img_size = getimagesize($path);
$img_size[4] = $img_size[1]/$height;
$faktor = 100/$img_size[4];
$img_size[1] = $img_size[1]/100;
$img_size[0] = $img_size[0]/100;
$img_size[1] = $img_size[1]$faktor;
$img_size[0] = $img_size[0]
$faktor;

if($img_size[0] >= 120){
$img_size[4] = $img_size[0]/$width;
$faktor2 = 100/$img_size[4];
if($faktor2 << $faktor){
$img_size[1] = $img_size[1]/100;
$img_size[0] = $img_size[0]/100;
$img_size[1] = $img_size[1]$faktor2;
$img_size[0] = $img_size[0]
$faktor2;
}
}

$imgh = createimage($img_size[0], $img_size[1]);
$imgh2 = imagecreatefromjpeg($path);
$imgsz = getimagesize($path);

imagecopyresized($imgh, $imgh2, 0, 0, 0, 0, $img_size[0], $img_size[1], $imgsz[0], $imgsz[1]);

imagepng($imgh, ‘test1.png’);
imagedestroy($imgh);
}
[/code]

Moin,

ja, ist einfach: Nimm statt imagecreate() imagecreatetruecolor()

MfG
myPages

Vielen Dank :wink: