Problem with ImageMagick

A

Anonymous

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

Code:
  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?
 
Yes, it works fine when I want to use some other operations!
actually Ive changed the code to:

Code:
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 ?
 
Actually Ive found someone else got the same problem with me!
http://studio.imagemagick.org/magick/viewtopic.php?t=2433&highlight=identify
 
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 ...".
 
SHAME ON ME!
you were right. hahaha

Code:
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!
 
Is there any way to convert PDF to image without ImageMagick and Ghostscript in PHP? :eek:fftopic:
 
ravi said:
Is there any way to convert PDF to image without ImageMagick and Ghostscript in PHP? :eek:fftopic:

I don't believe that's a thing. However, you should probably look around the forum for an answer
 
Back
Top