Page 1 of 1
Problem with ImageMagick
Posted: Thu Jan 27, 2005 8:49 am
by WoozyDuck
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?
Posted: Thu Jan 27, 2005 8:54 am
by Alexej Kubarev
does the program work that way from a command line?
if yes: try the same code from PHP command line..
Posted: Thu Jan 27, 2005 8:57 am
by WoozyDuck
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 ?
Posted: Thu Jan 27, 2005 9:02 am
by WoozyDuck
Actually Ive found someone else got the same problem with me!
http://studio.imagemagick.org/magick/vi ... t=identify
Posted: Fri Jan 28, 2005 8:00 am
by swirlee
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 ...".
Posted: Fri Jan 28, 2005 4:51 pm
by WoozyDuck
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!
Re: Problem with ImageMagick
Posted: Tue Nov 24, 2020 10:11 pm
by ravi
Is there any way to convert PDF to image without ImageMagick and Ghostscript in PHP?
