Page 1 of 1

Re: Sizing Problems

Posted: 2007-12-12T16:55:43-07:00
by anthony
A couple of things....
  • Use -resize instead of -geometry
  • Also -strip (or use -thumbnail resizing) to remove profiles.
  • Read in images BEFORE resizing them.
Also
  • 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.
For example the whole function ResizeImageUsingIM contents can be replaced with

Code: Select all

   Exec("$config[convert] \"$image\" -thumbnail \"$size"."x"."$size>\" -quality \"$config[imagequality]\" \"$newimage\" ");
  return file_exists($newimage);
without the need for the identify, or all the calculations as IM does that for you!

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.