Merge 4 IM calls, into 1?
Posted: 2013-01-25T18:50:08-07:00
I am currently 4 system calls in PHP for some image resizing scripts. I think this may work more stable if I can convert it into one command. Anyone know if this is possible?
step 1 (resize image down)
step 2 (check for max width)
step 3 (check for Minimum width)
Step 4 (check for Minimum height)
The basic objective is take an uploaded image, and size it down, then make sure its:
- size down to a maximum of 800px tall
- not wider than 200px
- at least 200px wide
- at least 100px tall
- - -
Anybody got any ideas?
step 1 (resize image down)
Code: Select all
system(binary_system_path()."convert $source -limit memory 1 -limit map 1 -thumbnail x800\> -bordercolor '#ffffff' -border 0 -gravity center -crop x800+0+0 +repage -strip -quality 90 -profile $rgbProfile $thumb");
Code: Select all
system(binary_system_path()."convert $thumb -limit memory 1 -limit map 1 -thumbnail '200X' $thumb");
Code: Select all
system(binary_system_path()."convert $thumb -limit memory 1 -limit map 1 -gravity center -background '#ffffff' -extent 200x".$tHeight." $thumb");
Code: Select all
system(binary_system_path()."convert $thumb -limit memory 1 -limit map 1 -gravity center -background '#ffffff' -extent ".$tWidth."x100 $thumb");
- size down to a maximum of 800px tall
- not wider than 200px
- at least 200px wide
- at least 100px tall
- - -
Anybody got any ideas?