Reputation: 1346
I am trying to get imagick installed (by far not an easy task, but helped enormously using the [filter] on https://mlocati.github.io/articles/php-windows-imagick.html) and running on my WAMP/Windows10/PHP7.0 webapp, but I am running into a black-hole on the readImage() call (the log file only goes up to 'checkpoint 2').
Looking at the Windows system events log I can see an Error Level Application event reading:
Faulting application name: httpd.exe, version: 2.4.23.0, time stamp: 0x5776399f
Faulting module name: php_imagick.dll, version: 7.0.10.0, time stamp: 0x58927660
Exception code: 0xc0000409
Fault offset: 0x000000000002468c
Faulting process ID: 0x4ba8
Faulting application start time: 0x01d44f71d980b2f3
Faulting application path: C:\wamp64\bin\apache\apache2.4.23\bin\httpd.exe
Faulting module path: C:\wamp64\bin\php\php7.0.18\ext\php_imagick.dll
Report ID: 1b3f5a6d-ed31-4fae-b73d-ebf0d17e9c94
Faulting package full name:
Faulting package-relative application ID:
This bug comes when running the following code via my WAMP
<?php
class Test {
public function doTrace($msgTx) {
$dt=date('[D M d H:i:s Y]', gmdate(time()));
error_log($dt.$msgTx."\n",3, "C:/test.log" );
}
public function doTest() {
$fn='C:/test.pdf';
if ( file_exists($fn) ) {
$im = new Imagick();
$this->doTrace("checkpoint 1");
$im->setResolution(300, 300);
$this->doTrace("checkpoint 2");
$im->readImage($fn."[0]"); //[0] for the first page
$this->doTrace("checkpoint 3");
$im->setImageFormat('png');
$this->doTrace("checkpoint 4");
header('Content-Type: image/png');
echo $im;
$this->doTrace("checkpoint 5");
}
else {
echo "Did not find $fn";
}
}
}
$try = new Test();
$try->doTest();
?>
This is me simply trying a version of the manual entry for readImage (http://php.net/manual/en/imagick.readimage.php#116812), so what is wrong here? Have I installed Imagick wrongly (php_imagick-3.4.3-7.0-ts-vc14-x64) or is it something else? (Note, I can make IM work on some simple tests)
My phpinfo() reads:
imagick
imagick module enabled
imagick module version 3.4.3
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version ImageMagick 6.9.3-7 Q16 x64 2016-03-27 http://www.imagemagick.org
Imagick using ImageMagick library version ImageMagick 6.9.3-7 Q16 x64 2016-03-27 http://www.imagemagick.org
ImageMagick copyright Copyright (C) 1999-2015 ImageMagick Studio LLC
ImageMagick release date 2016-03-27
ImageMagick number of supported formats: 234
ImageMagick supported formats 3FR, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CLIPBOARD, CMYK, CMYKA, CR2, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPS, DPX, DXT1, DXT5, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FPX, FRACTAL, FTS, G3, GIF, GIF87, GRADIENT, GRAY, GROUP4, GV, H, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCREENSHOT, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBP, WMF, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, YCbCr, YCbCrA, YUV
Thanks
Abe
Upvotes: 0
Views: 905
Reputation: 1346
So, with no obvious solution, I decided to try a different direction and see if I could run the convert command through the commandline. This pushed me onto having to install Ghostscript (https://www.ghostscript.com/download/gsdnld.html).
Now that Ghostscript is installed it seems that the PHP is now working - I get an image of the first page of the PDF.
Did I miss this on the installation instructions (I do not recall seeing Ghostscript being mentioned)?
A
Upvotes: 1