Hallo,
ich habe das ganze jetzt mit einem 70KB Bild erfolgreich probiert (und dabei auch gleich ein paar Fehler gefunden).
Korrigierte Version:
function createThumb($src,$dest,$new_w,$new_h){
$src_img = imagecreatefromjpeg($src);
$old_x = imageSX($src_img);
$old_y = imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w = $new_w;
$thumb_h = $old_y * ($new_h / $old_x);
}
if ($old_x < $old_y) {
$thumb_w = $old_x * ($new_w / $old_y);
$thumb_h = $new_h;
}
if ($old_x == $old_y) {
$thumb_w = $new_w;
$thumb_h = $new_h;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
imagejpeg($dst_img,$dest);
imagedestroy($dst_img);
imagedestroy($src_img);
}
Bleibt aber immer noch das Problem, wie ich das ganze mit großen Bildern hinbekomme.
Gruß,
Severin
--
They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.
-- Benjamin Franklin
They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.
-- Benjamin Franklin