IM + PHP

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
dope

IM + PHP

Post by dope »

This is a very stupid question. I had been using a third party php script to resize images using ImageMagick. It's outdated and doesn't work properly so I thought I'd try to use IM another way.

How do you use this? Do you need a long drawn out PHP script or should I be using some sort of interface to set this up? I basically have a directory full of images that I need to display thumb and full shots of. Do I use IM functions when I call the image on the page or what? This is what I was using previously:

Code: Select all

<img src="assets/product_thumb/magick.php/<?php echo $row_results['prdctImage_FileName']; ?>?resize(80x80)" border="0">
Thanks for any help.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: IM + PHP

Post by Bonzo »

I assume all your resizing is done in magick.php and your image details are kept in a database.
The code must be taking the name and the resize from the image path.

What is not working ? Can you display the contents of magick.php ? I always resize my images on upload and so do not use code like this.

Do you know your ImageMagick version ? If not the piece of code below should tell you.

Code: Select all

<?php
echo "<pre>";
exec("convert -version"); 
echo "</pre>";
?> 
dope

Re: IM + PHP

Post by dope »

I have no clue. My host tells me it's the current version. I am pulling the names from the db. When I try to see what version is running only pre prints out. Thanks.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: IM + PHP

Post by Bonzo »

The problem printing out the version could be mine; try changing exec to system:

Code: Select all

echo "<pre>";
system("convert -version"); 
echo "</pre>";
As I say the ImageMagick processing must be done within the file magick.php so we need to see the contents of that file.
Post Reply