Problem with ImageMagick

images php coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Problem with ImageMagick

Postby WoozyDuck » Thu Jan 27, 2005 8:49 am

I am using ImageMagick to get graphic file details with the code below:

Code: Select all

  exec("/usr/bin/convert identify 1.jpg",$output);
    for ($i=0; $i < count($output); $i++) {
       print "$output[$i]<br>";
    }


But it doesnt return anything for me!
The program path is correct cause I can use it, but when I use
identify to get information, it doesnt return anything, no error though!

Does anybody know whats wrong with my code?

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Thu Jan 27, 2005 8:54 am

does the program work that way from a command line?

if yes: try the same code from PHP command line..

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby WoozyDuck » Thu Jan 27, 2005 8:57 am

Yes, it works fine when I want to use some other operations!
actually Ive changed the code to:

Code: Select all

exec("/usr/bin/convert identify -format \"%wx%h\" 1.jpg -debug all",$output);
    for ($i=0; $i < count($output); $i++) {
       print "$output[$i]<br>";
    }


and it returns:

16:55:38 0:01 0.000u 21784 cache.c/DestroyCacheInfo/959/Cache:
destroy
16:55:38 0:01 0.000u 21784 blob.c/GetConfigureBlob/948/Configure:
Searching for configure file "delegates.mgk" ...
16:55:38 0:01 0.000u 21784 utility.c/IsAccessible/1560/Configure:
/usr/lib/ImageMagick-5.5.6-Q16/delegates.mgk [Success]
16:55:38 0:01 0.000u 21784 utility.c/IsAccessible/1560/Configure:
identify [No such file or directory]
16:55:38 0:01 0.000u 21784 cache.c/DestroyCacheInfo/959/Cache:
destroy
16:55:38 0:01 0.000u 21784 blob.c/GetConfigureBlob/948/Configure:
Searching for configure file "magic.mgk" ...
16:55:38 0:01 0.000u 21784 utility.c/IsAccessible/1560/Configure:
/usr/lib/ImageMagick-5.5.6-Q16/magic.mgk [Success]
16:55:38 0:01 0.000u 21784 jpeg.c/ReadJPEGImage/647/Coder:
enter
16:55:38 0:01 0.000u 21784 jpeg.c/ReadGenericProfile/373/Coder:
Profile: APP1, 7762 bytes
16:55:38 0:01 0.000u 21784 jpeg.c/ReadJPEGImage/749/Coder:
Interlace: nonprogressive
16:55:38 0:01 0.000u 21784 jpeg.c/ReadJPEGImage/751/Coder:
Data precision: 8
16:55:38 0:01 0.000u 21784 jpeg.c/ReadJPEGImage/753/Coder:
Geometry: 1944x2592
16:55:38 0:01 0.000u 21784 jpeg.c/ReadJPEGImage/827/Coder:
Quality: 97 (approximate)
16:55:38 0:01 0.000u 21784 jpeg.c/ReadJPEGImage/916/Coder:
Colorspace: RGB
16:55:38 0:01 0.000u 21784 jpeg.c/ReadJPEGImage/917/Coder:
Sampling factors: (2,1),(1,1),(1,1)
16:55:38 0:01 0.010u 21784 resource.c/AcquireMagickResource/160/Resource:
memory +38mb/38mb/7536mb
16:55:38 0:01 0.010u 21784 cache.c/OpenCache/2120/Cache:
open 1.jpg[0] (38.4m)
16:55:40 0:02 0.410u 21784 jpeg.c/ReadJPEGImage/1053/Coder:
return
16:55:40 0:02 0.420u 21784 resource.c/LiberateMagickResource/381/Resource:
memory -38mb/0mb/7536mb
16:55:40 0:02 0.420u 21784 cache.c/DestroyCacheInfo/959/Cache:
destroy 1.jpg[0]


it shows that the program is working!
so how can I use PHP COMMAND LINE for that ?

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby WoozyDuck » Thu Jan 27, 2005 9:02 am

Actually Ive found someone else got the same problem with me!
http://studio.imagemagick.org/magick/vi ... t=identify

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Fri Jan 28, 2005 8:00 am

You seem to be trying to pass "identify" as a parameter to the "convert" command, but from what I can tell "convert" doesn't accept an "identify" parameter; rather, "identify" is a command all its own.

I think you should try changing your command to "/usr/bin/identify -format ...".

User avatar
WoozyDuck
New php-forum User
New php-forum User
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby WoozyDuck » Fri Jan 28, 2005 4:51 pm

SHAME ON ME!
you were right. hahaha

Code: Select all

exec("/usr/bin/identify -format \"%wx%h\" 1.jpg",$output);
    for ($i=0; $i < count($output); $i++) {
       print "$output[$i]<br>";
    }


WORKS FINE!
cheers!
:-D

P.S. For that reason my name is WOOZY DUCK anyway!


Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest