Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP & Imagemagick - Identify ?

Status
Not open for further replies.

nomaam22

Programmer
Oct 6, 2006
9
CA
I am working with PHP and Imagemagick.

Could someone show me how to use the identify function when you are dealing with a submitted form. For example my form submits the following data in a POST

<input type="file" name="image">

Now I would like to take the passed variable for the image path and obtain the details of the image. I am able to download the image as I mentioned above but I am unable to use the identify command for some reason.

I have tried many different variations of the exec command but I can't get it to work.

exec("identify {$_FILES['image']}", $result);
$identify = $result[0];
print_r($identify);

The above command does not provide any information about the image.

I believe I have to pass the full path for the image in order to obtain the needed information. But how do I do this when using a form???

Thanks.
 
Hi

Take a look at the content of the [tt]$_FILES[/tt] array or read its documentation.
POST method uploads said:
[navy][tt]$_FILES['userfile']['tmp_name'][/tt][/navy]

The temporary filename of the file in which the uploaded file was stored on the server.
( Handling file uploads | POST method uploads )
PHP:
[COLOR=darkgoldenrod]exec[/color][teal]([/teal][green][i]"identify {$_FILES['image']['tmp_name']}"[/i][/green][teal],[/teal] [navy]$result[/navy][teal]);[/teal]
By the way, if you have the Imagick module installed, you could use the [tt]Imagick::identifyImage()[/tt] method.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top