I'm using imagemagicks geometry option to resize uploaded images from the upload temporary directory into a designated image directory. The Imagemagick manual suggests to fix an exclaimation mark next to the image dimensions e.g. 120x85!
The following function works fine but retains the original images aspect ratio, I want to resize the image to a set width & height.
Code as follows;
function ResizeImage($picwidth, $picheight, $temp_upload_loc) {
global $convertcmd;
//global $identifycmd;
global $resizequal;
global $destination;
$input_img_loc = $temp_upload_loc;
$output_img_loc = "\"" . $destination . "\"";
$width = $picwidth;
$height = $picheight;
echo "image name is ".$imgname."<br>";
echo "destination is ".$destination."<br>";
echo "width = ".$picwidth." height = ".$picheight."<br>";
$convertit = $convertcmd . " -geometry " . ${width}. "x" . ${height} . " -quality " . ${resizequal}. " \"" . $input_img_loc . "\"" . " " . $output_img_loc;
if (!file_exists($imageresized)) {
exec($convertit);
}//endif file_exist
} // End Function ResizeImage
I have tried ${height} . "!" . " -quality etc..., but this doesn't execute.
Regards
Synfield 😕