SOLVED: MagickReadImages() error on a valid image?

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Locked
diegocaprioli
Posts: 5
Joined: 2011-08-13T16:00:33-07:00
Authentication code: 8675308

SOLVED: MagickReadImages() error on a valid image?

Post by diegocaprioli »

Hello,

I have installed ImageMagick-6.7.1-7 from source. The installation went well, and the logo of the installation example is displayed fine. Then I installed MagickWandForPHP 1.0.8, and the installation also went well.

I tested it with phpinfo, and I'm getting de imagewand box with this information on it:

Code: Select all

magickwand
MagickWand Backend Library	ImageMagick
MagickWand Extension Version 	1.0.8
ImageMagick support 	enabled
ImageMagick version 	ImageMagick 6.7.1-7 2011-08-18 Q16 http://www.imagemagick.org
ImageMagick QuantumRange (MaxRGB) 	65535
MagickWand supported image formats 	3FR, A, AAI, AI, ART, ARW, AVI, AVS, B, BMP, BMP2, BMP3, C, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DNG, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FITS, FRACTAL, FTS, G, G3, GIF, GIF87, GRADIENT, GRAY, GROUP4, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, J2C, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, M4V, MAC, MAP, MAT, MATTE, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMV, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV 
Then I tried to do a first test of displaying an image with this code:

Code: Select all

$resource = NewMagickWand();
$result = MagickReadImage( $resource, "image.jpg");
header('Content-Type: image/jpeg');
MagickEchoImageBlob( $resource );
But the image never gets printend on the browser. I modified the code to this:

Code: Select all

$resource = NewMagickWand();
$result = MagickReadImage( $resource, "image.jpg");
if ($result) {
	echo "Leyó OK!";
} else {
	echo "error al leer";
}
/*header('Content-Type: image/jpeg');
MagickEchoImageBlob( $resource );*/
And now I'm always getting error on MagickReadImage(). I checked the image.jpg file, and is in the same directory of the php script that I'm running and is readable and writable by all. I can see it without problem with other software, like GIMP. I don't know what else could be generating this problem... can anyone give me a had whit this?

Thanks in advance!
Last edited by diegocaprioli on 2011-08-18T18:42:02-07:00, edited 1 time in total.
Diego

diegocaprioli
Posts: 5
Joined: 2011-08-13T16:00:33-07:00
Authentication code: 8675308

Re: MagickReadImages() error on a valid image?

Post by diegocaprioli »

I've solved the problem. I tested the image.jpg with "display image.jpg", to see if I could get some more info... and I got this error:

Code: Select all

display: Wrong JPEG library version: library is 62, caller expects 80 
I remembered that I had installed a new "libjpeg". I executed the tests of ImageMagick with "make check" and discovered that some of the tests failed with similar errors, so I uninstalled the last library. I have a PC running Ubuntu 11.04, so I checked in Synaptic PAckage Manager and I already had jpg libraries installed, so I reinstalled ImageMagick and MagicWand again and... problem solved! :D
Diego

Locked