Page 1 of 1

Thumbnailing with php code?

Posted: 2008-08-23T17:19:27-07:00
by acctman
hi how would i use the imagemagick command line code that i got from the user section in php

If i read the manual correctly this should keep the sizing within the aspect ratio right? height of 125px with a max width of 190px

convert large.jpg -auto-orient -thumbnail 190x125 tn_small.jpg

Re: Thumbnailing with php code?

Posted: 2008-08-23T20:27:31-07:00
by fmw42
-thumbnail 190x125 will scale to 190 (assuming your image width>height)

-thumbnail 190x125^ will scale to 125 (assuming your image width>height)

on windows you need ^^ (as ^ is an escape character)

see http://www.imagemagick.org/script/comma ... php#resize (-thumbnail should follow the same scheme as -resize)

Re: Thumbnailing with php code?

Posted: 2008-08-23T22:21:22-07:00
by acctman
i'm still unsure as to how to use this in PHP coding.

Re: Thumbnailing with php code?

Posted: 2008-08-23T22:29:46-07:00
by fmw42
can't help you there. hopefully someone else can or try your question on one of the IM PHP forums.

Re: Thumbnailing with php code?

Posted: 2008-08-24T20:12:33-07:00
by anthony
See Rubble Web for examples of using command line IM from PHP scripts.
http://www.rubblewebs.co.uk/imagemagick/

Re: Thumbnailing with php code?

Posted: 2008-08-30T12:33:16-07:00
by Bonzo
Just back from holiday; did you get this sorted ?

Re: Thumbnailing with php code?

Posted: 2008-09-12T14:46:53-07:00
by acctman
Bonzo wrote:Just back from holiday; did you get this sorted ?
i tried this code with no luck

exec("convert -thumbnail 190x125 -auto-orient -quality 75 -strip watermarked.jpg tn_small.jpg");

maxwidth 190 and maxheight 125

Re: Thumbnailing with php code?

Posted: 2008-09-12T15:10:03-07:00
by Bonzo
Versions after 6. something need the image reading in first.
-thumbnail strips the image anyway so you do not need -strip
-auto-orient only works if the image has the option ?

So I would try:

Code: Select all

exec("convert watermarked.jpg -thumbnail 190x125 -quality 75 tn_small.jpg");
What do you mean when you say its not working?

Re: Thumbnailing with php code?

Posted: 2008-09-12T15:52:19-07:00
by acctman
Bonzo wrote:Versions after 6. something need the image reading in first.
-thumbnail strips the image anyway so you do not need -strip
-auto-orient only works if the image has the option ?

So I would try:

Code: Select all

exec("convert watermarked.jpg -thumbnail 190x125 -quality 75 tn_small.jpg");
What do you mean when you say its not working?
i changed it to resize and move the quality after the main image and everything works now

Code: Select all

exec("convert watermarked.jpg -quality 75 -resize 190x125 tn_small.jpg");