Advice on php exec usage

Hi all,

I have a number of small image processing programs (written by myself in C/C++) that I’d like to make accessible through a web interface. By this I mean: I want to upload an image, call a specific program which manipulates the image and finally return on a results page a download link for the resultant image.

I think this is completely do-able? I’ve done a fair bit of dabbling with php in the past (though it was about 5 years ago, so i’m very rusty), so I believe I should be able to use php exec to achieve most of this? Am I right in thinking using the compiled programs is probably optimum in terms of performance on the server, compared to reimplementing the algorithms in php?

Any other comments or suggestions would be most welcome! Or even better would be some sketelon code to handle this? I guess some thing like an Image Magik thumbnail generator in php would be an ideal starting point for me?

Anyone any thoughts

Not great at web site design but like to work with php; enjoy photography and have just brought a dslr that I am trying to learn how to use.

Just been trying to get a good photo of a dragonfly and seem to be fighting dof.

You can see some Imagemagick with php exec() examples on my site.

exec() calls an external program - not sure how but I suppose if it is somewhere on the server it will run.

I have been doing some more speed tests and when I finish the report I will post a link.

Method------------------------------------------Average time
Imagick thumbnail------------------------------0.31130666732788
php exec() imagemagick jpg hint -thumbnail-----0.31260333061218
php exec() -thumbnail--------------------------0.31316999594371
Imagick resize----------------------------------0.45480666955312
php exec() Imagemagick -resize-----------------0.46112333138784

You can see from the list above Imagick and GD are built into php but there is not much of a difference in times to calling Imagemagick which is an external program.

People comment a lot about averidge run time etc. but from what I have found the greatest influence is server load - if you resize when the server is quite you can do it in say 0.3113… seconds but you could just do it at a server busy time and it could take over a second.

Not sure about the server trican as it was not mine. My hosts do not want to install Imagick.

Thanks for the comments about my site - it does not get as much attention as I should give it :rolleyes:

If you want a copy of my speed code to try let me know; the code is a mess as I have been trying different options etc. out. It will also produce a chart at the end using Imagemagick.

A busy server:

A better output:

Cool, thanks for the info, that was really useful! Is that a beefy dedicated server or a VPS? I was thinking of using a VPS myself.

Btw your website is great - super examples!

Out of interest if you do go VPS and install Imagemagick be careful of the server setup - get a direct answer from the server suppliers first.
I installed Imagemagick on a Vero server without problem but could not get it to work on a Media temple one.
I am not an expert with servers and I have no idea why one worked OK and the other didn’t

Thanks for the tips - will certainly be careful about choosing a VPS - that last time I dabbled with a low cost VPS, it was clear after a few days it was being run by a complete fly by night operator.

You certainly have tons of useful info on Image Magick on your site. Are you a web designer/programmer/photographer/ all of the above!?