- Use -resize instead of -geometry
- Also -strip (or use -thumbnail resizing) to remove profiles.
- Read in images BEFORE resizing them.
- You don't need to check width and height of images for the resize, you can have IM resize images to fit a box, and never enlarge. By default IM will preserve the image aspect ratio.
Code: Select all
Exec("$config[convert] \"$image\" -thumbnail \"$size"."x"."$size>\" -quality \"$config[imagequality]\" \"$newimage\" ");
return file_exists($newimage);
PS; your "desc:" comment after this function also need updating!!! It is missleading to say that the function 'resizes image' when it is 'reading' or 'writing' images.