I know there's been a lot of entries on this type of thing and I can do the file upoad and image resize seperately but when I try to UPLOAD an image, RESIZE it and then store it - it all goes wrong. Here is what I have:
// thumbnail sizes
$thumb_max_width = 120;
$thumb_max_height = 120;
$thumb_quality = 90;
$size = getimagesize($my_photo);
$input_image = imagecreatefromjpeg($my_photo);
$ratio = min($thumb_max_width,$size[0],$thumb_max_height/$size[1]);
$output_image = ImageCreate(round($size[0] $ratio),round($size[1] $ratio));
imagecopyresized($output_image, $input_image, 0, 0, 0, 0, round($size[0] $ratio), round($size[1] $ratio), $size[0], $size[1]);
// create output image
$new_photo = imagejpeg $output_image,$output_file,$thumb_quality);
@copy($new_photo, "/home/xxx/xxx/photos/")
or die("Couldn't copy the thumbnail photo!");
All this seems to do is display the thumbnail - I just want it to store the newly resized photo on the server.
Any advise would be appreciated.