class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
We are trying to use the class to make multiple sized images of the original image. The first thumbnail size is generated fine, the medium size ends up being the same size as the original.
Also, the $medium_width and $medium_height that get returned are the same as the thumbnail
// Let's make some baby photos!
require_once(SUNSHINE_PATH.'/includes/class.upload.php');
$image = new Upload($upload_dir['basedir'].'/sunshine/'.$dir.'/'.$basename);
// Resize defaults
$image->image_resize = true;
$image->jpeg_quality = 100;
$image->auto_create_dir = true;
$image->dir_auto_chmod = true;
$image->image_ratio_y = true;
$image->file_overwrite = true;
// Make thumbnail
$image->image_x = 100;
$image->Process($upload_dir['basedir'].'/sunshine/'.$dir.'/thumbnail');
$thumb_result = $image->processed;
$thumb_width = $image->image_dst_x;
$thumb_height = $image->image_dst_y;
// Make medium
$image->image_x = 400;
$image->Process($upload_dir['basedir'].'/sunshine/'.$dir.'/medium');
$medium_result = $image->processed;
$medium_width = $image->image_dst_x;
$medium_height = $image->image_dst_y;
// If we were able to make thumbnail/medium, then let's add attachment to the database
if ($thumb_result && $medium_result) {
...
} else {
echo 'error : ' . $image->error;
}
Also, the $medium_width and $medium_height that get returned are the same as the thumbnail