Page 1 of 1
Php & ImageMagick
Posted: Fri Aug 30, 2002 9:43 am
by DSM
Has anyone used this combination before. I am working on a project and have a fairly good idea of how it should work. But never having used imagemagick before I am a little sketchy on the proper procedure.
Any help is great appreciated.
Posted: Fri Aug 30, 2002 10:19 am
by hedge
I use it to build thumbs, I simply use system calls from php.
Posted: Fri Aug 30, 2002 11:55 am
by DSM
Ok, maybe I am not understanding this as much as I thought I was.
Here's the scenario.
Have a image named car.jpg in dir images/upload
The image car.jpg is 300 x 300
I want to use imagemagick to convert the image to display it at 120x120 in a table. How do I call the imagemagcik command and can I do it on the fly?
Thanks
Posted: Fri Aug 30, 2002 12:25 pm
by samscripts
I think the command you need is 'convert' which should exist in the imagemagick directory.
exec("/path/to/imagemagick/convert -scale 120x120 images/upload/car.jpg /path/to/save/in/car.jpg")
http://www.imagemagick.org/www/convert.htm
I'm not sure if its the -scale or the -resize argument that you need. As to doing it on the fly, I'm not sure if ImageMagick will output directly to the browser like this, but it probably can if you read the manual.
If not, you could just generate the thumbnail and save it to disk, then readfile() it, then delete the generated thumbnail.
hope this helps, Sam
Posted: Fri Aug 30, 2002 3:36 pm
by DSM
hedge wrote:I use it to build thumbs, I simply use system calls from php.
Does look right to you,
$abpath = absoulte path to images.
I am taking image resizing and saving as thumbnail
Code: Select all
system("/usr/local/bin/imagemagick/convert -size 75x75 $abpath/$img1_name -resize 75x75 $abpath/$img1_thumbnail_name");
Posted: Wed Oct 02, 2002 7:41 pm
by pa
Hello,
Maybe too late
Note there exists an image extension for php available on pear.php.net.
Besides that, there s also a library that let you use the same functions whatever image library you want (gd, netpbm, imagick ext, imagick command line) on pear. Image_Transform.
hth
pa