9

I work under windows and wamp server.

this is my PHP code with Imagick

$imagick = new Imagick($_SERVER['DOCUMENT_ROOT'] . '/' . $this->_name);

where $_SERVER['DOCUMENT_ROOT'].'/'.$this->_name displays :

D:/Sources/my_project/public/media/2/9/1/05201502/55450e1b6543a05201502_9.PNG

I checked that image and it does exist in the folder.

But Imagick throws an exception :

Uncaught exception 'ImagickException' with message 'no decode delegate for this image format `D:/Sources/my_project/public/media/2/9/1/05201502/55450b10d8ea705201502_9.PNG' @ error/constitute.c/ReadImage/555' in D:\Sources\my_project\library\project\Image.php on line 225

I looked for a solution, but didn't find any, how can I fix this?? thank you

Update: This is the result when I type convert -version in the command line :

  Version: ImageMagick 6.8.8-4 Q16 x86 2014-01-29 http://www.imagemagick.org
  Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
  Features: DPC Modules OpenMP
  Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo \
             png ps rsv g tiff webp xml zlib

update

This is the phpinfo of imagick.

ImageMagick number of supported formats: 0
ImageMagick supported formats: no value

SmootQ
  • 2,096
  • 7
  • 33
  • 58
  • 1
    Please add also `phpinfo()` ImageMagick supported image formats. Also - make sure that file is readable by PHP with `readfile()` or similar function. – Kalle Volkov May 10 '15 at 12:01
  • 1
    @KalleVolkov, Thank you for the suggestion, I updated ;) – SmootQ May 10 '15 at 12:03

3 Answers3

7

Seems that your ImageMagick PHP module does not support any image formats.

Try to find other ImageMagick installation or install PHP from the scratch.

Also - seems that there is already question/answer in SO about that

Community
  • 1
  • 1
Kalle Volkov
  • 448
  • 4
  • 8
  • 1
    Although I didn't solve fully my problem, your answer helped me alot, I think I'm now closer to find a solution. The problem I think is with the MOD_xxx.dll files, apache looks for them in /bin folder, and I have them in my imagick folder .... anyway, thanks a lot :), I've been struggling with this for more than 2 weeks. – SmootQ May 11 '15 at 21:08
6

You should run

convert -version

and report the output. On my system it is

Version: ImageMagick 6.9.0-0 Q16 x86_64 2014-12-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc jbig \
                      jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps \
                      rsvg tiff webp wmf x xml zlib

Does your output include png as one of the built-in 'delegates'?

If not, update your installation, or build from current sources.

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
  • Thank you for your answer, +1 , this is my output `C:\Users\TAQI>convert -version Version: ImageMagick 6.8.8-4 Q16 x86 2014-01-29 http://www.imagemagick.org Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC Features: DPC Modules OpenMP Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsv g tiff webp xml zlib` – SmootQ May 03 '15 at 17:22
  • 1
    As you can see, it contains png and jpeg, notice that the problem is not only for png images, but also for jpeg images. – SmootQ May 03 '15 at 17:22
  • 1
    @SmootQ: Please update your original question with the contents of your comment. It's not much use to have this info in a comment hidden somewhere down south of the page... – Kurt Pfeifle May 03 '15 at 20:15
4

Finally I found solution for my windows openserver/nginx/php-fpm installation:

  1. Download latest php_imagick distributive for your version of PHP from http://windows.php.net/downloads/pecl/releases/imagick/ (e.g. php_imagick-3.4.3-7.1-ts-vc14-x64.zip)
  2. Extract only php_imagick.dll from this archive to your "php/ext" folder.
  3. Run phpinfo() and check value at line "Imagick compiled with ImageMagick version" (mine was: "ImageMagick 6.9.3-7 Q16 x64 ...").
  4. Now go to http://windows.php.net/downloads/pecl/deps/ and download correct version of Imagick-*.zip file (mine was: ImageMagick-6.9.3-7-vc14-x64.zip).
  5. Extact this archive and copy all *.dll files from "/bin" folder to yout "php/ext" folder (about 145 files).
  6. Restart server and check phpinfo(). ImageMagick now supports about 230+ formats.

Sometimes phpinfo() displays that imagick supports all formats, but php scripts are not respond - in this case double check that you download correct version of Imagick-*.zip for your installations. (ts/nts, VC11/VC14, x64/x86)

Andrey Radomanov
  • 1,777
  • 1
  • 13
  • 6
  • Thank you so much for your answer, It's been two years since I posted the question , thank you for taking the time to answer, sure there are many others who need as many answers as possible. +1 – SmootQ Mar 23 '17 at 20:14