PHP intergration

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
darkqueen

PHP intergration

Post by darkqueen »

Hello. I have a classified site that uses PHP and Smarty templates. We have problems with photo uploads to ads. It appears that our server does not allot enough PHP memory for large images.Can we use ImageMagick on the server to resize the images and how would that integrate with our site.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PHP intergration

Post by fmw42 »

I don't know much about the integration. You just install IM. See http://www.imagemagick.org/download/www ... .html#unix and http://www.imagemagick.org/script/advan ... lation.php

Then use PHP exec command to run the IM command line command. See http://www.rubblewebs.co.uk/index.php for numerous examples.

But are you sure the problem is not just one of limitation of size on upload?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: PHP intergration

Post by Bonzo »

ImageMagick uses less memory than GD but as Fred says the problem is that ImageMagick can not work on the image until its on the server and the file size can be restricted in the upload form and php.ini file.
You can ask your hosts to increase the upload file size; I think its typicaly set at 2Mb and check there is no restriction in your upload form.

The problem I have found with user uploads is that a lot of people do not know how to resize an image on the PC. It seems so simple to us but a lot of people have no idea and just try to upload the photo straight of the digital camera and these photos are getting larger all the time.

As to implimenting on your site you would need to modify your upload form and just add the IM code - I assume you are checking for malicious content already :)

I have no idea how Smarty works and if your form is a Smarty addin you would need to ask somebody on their form how to impliment it. We can suggest some code you use if you let us know your current code.
darkqueen

Re: PHP intergration

Post by darkqueen »

Thank you for your quick response.I will speak to my host.
Post Reply