I currently have a content management system written in PHP/MySQL. On one page, the administrator is able to upload a picture which is resized to give the image that will be shown:
Code: Select all
// Store the orignal file
copy($uploadedPhoto['tmp_name'], $images_dir."/".$filename);
// Get the image size
$size = GetImageSize( $images_dir."/".$filename );
$width = $size[0];
$height = $size[1];
if($width > $height) {
$resize_width = 500;
$resize_height = (int)(500 * $height / $width);
} else {
$resize_width = (int)(500 * $width / $height);
$resize_height = 500;
}
exec("convert $images_dir/$filename -geometry {$resize_width}x{$resize_height} $images_dir/rs_$filename");
In either image it may be required to be cropped to the square and then resized to 100x100px.
Is there a way to do this dynamically at upload? Does anyone know of any scripts where the user can, for example, click and drag over an image preview to set the croppable area?
I hope this is at least a little coherent. Cheers!