Reputation: 2259
On my Ubuntu 18.04.1 LTS Server I have ImageMagick, Apache2, Php 7.2 and Php iMagick 3.4.3 set up.
On terminal, convert -version
outputs:
Version: ImageMagick 7.0.8-12 Q16 x86_64 2018-10-14 https://imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib heic jbig jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib
PhpInfo()
for Imagick outputs:
On the terminal, convert pic.x3f pic.jpg
works perfectly with no errors and the file is created.
However over php-imagick and apache2 server, $img = new Imagick('temp-upload-path');
for the same 'pic.x3f' file returns
Fatal error: Uncaught ImagickException: no decode delegate for this image format `XEF' @ error/constitute.c/ReadImage/556 in /var/www/html/Upload.php:45 Stack trace: #0 /var/www/html/Upload.php(45): Imagick->__construct('/tmp/phpvFoXK3') #1 {main} thrown in /var/www/html/Upload.php on line 45
The same is true for files for formats MDC and RAW, (Can be read in ImageMagick but returns the error on Php's iMagick).
Also, Formats: DCR NRW ARW RW2 SR2 SRF KDC are all successfully read in ImageMagick but on attempting to read and convert them in Php's Imagick, this is returned:
Fatal error: Uncaught ImagickException: TIFF directory is missing required "ImageLength" field. `MissingRequired' @ error/tiff.c/TIFFErrors/650 in /var/www/html/Upload.php:45 Stack trace: #0 /var/www/html/Upload.php(45): Imagick->__construct('/tmp/phpf9Rylo') #1 {main} thrown in /var/www/html/Upload.php on line 45
It appears it is unable to read them via PHP-iMagick which is supposed to link to the system's ImageMagick that successfully reads them. I am yet to discover issues with other formats, jpg, png, tiff, webp etc are all being read fine. This is happening with RAW formats.
Any help is appreciated
Upvotes: 2
Views: 5894
Reputation: 2259
Turns out the issue was that since I was pointing PHP-iMagick to the tmp path of the uploaded file, which had no file extension, PHP-iMagick had a hard time processing what the format was. I fixed it by moving the temporary uploaded file to another location and giving it it's original name and extension so that PHP-iMagick can correctly identify the format and read the image as expected.
Upvotes: 4