Unable to work on ImageMagick properly on Windows xampp - php

I read all the questions before posting this .
I am trying to install ImageMagick on my local system Windows 7.It gets installed without But when i try using it to crop images I get NoDecodeDelegateForThisImageFormat .
I am running Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
This is what i did
I installed ImageMagick ImageMagick-6.8.9-8-Q16-x86-dll.exe (I tried 6.8.1 and 6.7 also)
I got the dll from http://pecl.php.net/package/imagick/3.1.2/windows TS for PHP 5.4
Updated php.ini
The server started with out problem .
I checked via cmd the ImageMagick is working fine.
phpinfo() ImageMagick number of supported formats: 0
I tried many DLL's but none is working i need a solution to this .
Also phpinfo keeps on showing ImageMagick version:ImageMagick 6.8.8-4 Q16 x86 2014-01-29 even when i uninstalled it / updated it .
identify -version
Version: ImageMagick 6.8.9-8 Q16 x86 2014-08-26 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
I am trying to open Jpg.

ImageMagick inside php is a really different from the standalone cmd version.
So, you need not only the php_imagic.dll connected to your php.ini.
But also the CORE_RL_*_.dll files in the Apache bin directory.
This will enable the readers.
Now you need the ENcoders. These are obtained from the standalone installation and located in [ImageMagick install dir]\modules\coders. Copy them to Apache's bin directory as well.
Now check the phpinfo();
The downside of this is that you need to match dll's from Standalone version to the one that is Compiled in the php-extension.

Related

Imagick unable to open module file

I'm trying to use Imagick with PHP. I have installed the program, replaced the core dll files, loaded the dll extension with xampp, but now I get this error:
unable to open module file
`C:\Users\sudom\AppData\Local\ImageMagick\IM_MOD_RL_png_.dll': No such
file or directory # warning/module.c/GetMagickModulePath/830
This is the line causing the problem: $image->setImageFormat('png');.
I took a look to the AppData/Local folder, but there's no ImageMagick folder. If I place it there manually, it throws another error.
I use:
ImageMagick-7.0.7-11-Q16-x86-dll
php_imagick-3.4.3-7.1-ts-vc14-x86
Downlod the latest version from here
https://www.imagemagick.org/script/download.php
ImageMagick-7.0.7-12-Q16-x64-dll.exe
or
ImageMagick-7.0.7-12-Q16-x86-dll.exe
install, make sure adding the Imagick folder to the system PATH.
Optionally you can tick legacy utilities (convert, mogrify) during installation. and check in cmd 'magick -version'
c:\convert --version Version: ImageMagick 7.0.7-12 Q16 x64 2017-11-29
http://www.imagemagick.org Copyright: Copyright (C) 1999-2015
ImageMagick Studio LLC License:
http://www.imagemagick.org/script/license.php Visual C++: 180040629
Features: Cipher DPC Modules OpenMP Delegates (built-in): bzlib cairo
flif freetype gslib jng jp2 jpeg lcms lqr openexr pangocairo png ps
raw rsvg tiff webp xml zlib
Download php_imagick.dll from https://pecl.php.net/package/imagick/3.4.3/windows
meets your php version requirments, put in to ext folder of php and add it to php.ini file.
extension=php_imagick.dll
Than, go to http://windows.php.net/downloads/pecl/deps/
find needed version
3/27/2016 5:32 PM 32707238 ImageMagick-6.9.3-7-vc11-x64.zip
3/27/2016 5:33 PM 31517070 ImageMagick-6.9.3-7-vc11-x86.zip
3/27/2016 5:34 PM 38717224 ImageMagick-6.9.3-7-vc14-x64.zip
3/27/2016 5:34 PM 37376244 ImageMagick-6.9.3-7-vc14-x86.zip
download package and put all the DLLs files from ImageMagick-6.9.3-7-vc1x-xxx.zip\bin\ except ImageMagickObject.dll to ...\apache\bin\ and restart the apache service.
MUST WORK!
P.S. You can also find all the stuff from mentioned above resources for PHP 7.2 except pecl library. Need to wait for a while.

Windows PHP Imagick not working

I am trying for 1 days and this php imagick don't work in windows. It shows
ImageMagick number of supported formats: 0
ImageMagick supported formats no value
First I went to official php website from here
http://windows.php.net/download/
And downloaded VC14 x64 Non Thread Safe (2017-May-09 23:02:49) PHP 7.1.5
I extracted it into C:\ProgramData\php and added it to PATH variable.
And from that directory i renamed php.ini -devlopment to php.ini
And changed line 738 to extension_dir = "ext" so that extensions can be loaded in PHP.
Then php must be working now.
I went to http://windows.php.net/downloads/pecl/releases/imagick/3.4.3/
And downloaded php_imagick-3.4.3-7.1-nts-vc14-x64.zip
And from that zip file i extracted php_imagick.dll into C:\ProgramData\php\ext directory
And also from that zip file I extracted CORE_RL_*.dll into C:\ProgramData\php folder.
And I added extension=php_imagick.dll to php.ini file at line 892
After that i went to http://windows.php.net/downloads/pecl/deps
And downloaded ImageMagick-6.9.3-7-vc14-x64.zip and extracted content of that folder to C:\ProgramData\ImageMagick directory. And I added C:\ProgramData\ImageMagick\bin to my path.
I think I have done all configuration.
But when I create index.php and add phpinfo() function to file in desktop and try to run
php -S localhost:8080
and go to localhost:8080 in web browser it shows
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: 0
ImageMagick supported formats no value
Clearly it is not working .Where did I make mistake. Imagik is so painful to install :(
Recently I found this solution:
I went to C:\ProgramData\php and deleted CORE_*.dll file which i copied .
I needed to copy that as doing php -v was showing error at that time.
and after immediately deleting and rebooting server it showed
ImageMagick number of supported formats: 234
I don't know what is happening but i am happy it is working
And above steps will work as documentation for other user who are in problem like me :)

Suddenly getting ImageMagick "no decode delegate" errors?

I run a site that lets people upload JPEGS, that are then resized and have a .png watermark applied over the top of them.
As of today, a lot of the uploads are failing.
Uncaught ImagickException: no decode delegate for this image format `PNG' # error/constitute.c/ReadImage/501
The weird thing is, some still work fine, complete with the watermark.
I did a yum update the other day, and it installed a new version of ImageMagick and -devel and -last-libs, I'm guessing this broke something.
As for the fact that some uploads still work - maybe some of my php-fpm processes are still somehow using the older version?
I'm on CentOS 6.
Can someone point me to a quick fix for this please, my site has hundreds of visitors on it right now, and it's going to hurt me if I can't fix this!
Thanks.
convert -version gives me this:
Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-05-28 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype jpeg lcms tiff x zlib
(Although I have no idea what it showed before things broke).
These are the packages I currently have installed:
ImageMagick-6.7.2.7-4.el6_7.x86_64
ImageMagick-devel-6.7.2.7-4.el6_7.x86_64
ImageMagick-last-libs-6.9.4.1-1.el6.remi.x86_64
php70-php-pecl-imagick-3.4.2-1.el6.remi.x86_64
Have you restart the server (apache or fpm) after the upgrade ?
As for each new version, path to the coders change (as the version is part of the path), so the server need to be restarted.
See: https://github.com/remicollet/remirepo/issues/33

ImageMagick No decode delegate for this image format

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
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
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.
Finally I found solution for my windows openserver/nginx/php-fpm installation:
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)
Extract only php_imagick.dll from this archive to your "php/ext" folder.
Run phpinfo() and check value at line "Imagick compiled with ImageMagick version" (mine was: "ImageMagick 6.9.3-7 Q16 x64 ...").
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).
Extact this archive and copy all *.dll files from "/bin" folder to yout "php/ext" folder (about 145 files).
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)

php5-imagick on Ubuntu 14.04

I've spent quite some time googling for this issue, but to no avail, so I was hoping to get some help out here.
I'm using Ubuntu 14.04 and I've installed php5-imagick, ImageMagick and some extra libs for it to function. Testing the installation from the command line works perfectly and all delegates are installed according to 'convert -list configure' (output shown below).
It was working and performing perfectly before. The only thing I can think of is some system/security updates of Ubuntu. My code nor the IM installation were changed by any user actions before this error showed up.
The problem is when I call Imagick from my PHP script, it shows this error:
#420: no decode delegate for this image format '/' # error/constitute.c/ReadImage/544
This error is shown for both JPG and PNG.
Any help is greatly appreciated!
Output of 'convert -version':
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Output of 'convert -list configure':
DELEGATES bzlib djvu fftw fontconfig freetype jbig jpeg jng jp2 lcms2 lqr lzma openexr pango png rsvg tiff x11 xml wmf zlib
LIBS -lMagickCore -llcms2 -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lfftw3 -lfontconfig -lfreetype -lXext -lSM -lICE -lX11 -lXt -llzma -lbz2 -lz -lm -lgomp -lpthread -lltdl
I think the problem here is that Imagemagick isn't configured to support SVG. Installing basic php5-imagick package doesn't bring in some extras which you'll need for doing this.
To install support for SVG in PHP Imagick type the following into a terminal on the server in question:
sudo apt-get update
sudo apt-get install libmagickcore5-extra
Apt will list a load of dependent packages, including SVG libraries, and will ask you if you'd like to continue. Press Y and let it get on with it.
It appears that you're trying to open the file named '/'.
Strangely enough Imagick is not able to open that file.
Try passing in a real image filename.
Check the file to be processed with the vim command. Probably not an image.
I had a similar problem. You can see it here:
ImageMagick on Ubuntu 14.04 No decode delegate

Categories