I found a script that dynamically resizes photographs to a specified size. If I upload any photograph that is more than 500k the script does not show the resized photograph. All I get is a blank image placeholder.
Anything under this size and it is fine, the photograph gets displayed. I have tried another script and it does the same thing. Very strange.
Here is the script I am using.
<?php
// The file
$filename = $photo;
// Set a maximum height and width
$width = 200;
$height = 200;
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
?>