// Set a maximum height and width $width = 200; $height = 200; //$timestamp_pic.jpg als Quelle $src_file = imagecreatefromjpeg("/images/$timestamp_pic.jpg"); // Content type header('Content-type: image/jpeg'); // Neue Masse ermitteln list($width_orig, $height_orig) = getimagesize($src_file); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; } // Neues Bild erstellen $dest_file = imagecreatetruecolor($width, $height); // Neues Bild füllen imagecopyresampled($dest_file, $src_file, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); imageinterlace($dest_file); // Output imagejpeg($dest_file, "test.jpg", 80);