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
Related
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 :)
I'm having a weird imagick issue that I can't seem to diagnose.
I have the following source image:
And the following code:
$img = new Imagick($path);
header("Cache-Control: private, max-age=10800, pre-check=10800");
header("Pragma: private");
header("Expires: " . date(DATE_RFC822,strtotime(" 11 months")));
header('Content-type: image/png');
echo $img;
This results in the following image:
This only happens with a very small subset of the large library of similar icon images I have, and I cannot figure out why. Googling around I've found that some ImageMagick versions have issues with weird color profiles, but they all have the same color profile (sRGB), they're all the same dimensions, and while this image is greyscale it does not only happen to greyscale images, etc.
Even curiouser, it does not happen at all on my staging server, which runs the same the same version of php5-imagick (originally 3.2.1 but upgraded to 3.3.0RC2 in the hopes of making this problem go away). The only relevant difference I can find between the two servers is that when running phpinfo, the staging (unaffected) server says
Imagick compiled with ImageMagick version ImageMagick 6.8.9-9 Q16 x86_64 2015-01-05 http://www.imagemagick.org
Imagick using ImageMagick library version ImageMagick 6.8.9-9 Q16 x86_64 2015-09-19 http://www.imagemagick.org
while the production (affected) server says
Imagick compiled with ImageMagick version ImageMagick 6.7.7-10 2014-03-08 Q16 http://www.imagemagick.org
Imagick using ImageMagick library version ImageMagick 6.7.7-10 2014-03-08 Q16 http://www.imagemagick.org
To try to remedy this I've compiled and installed ImageMagick 6.9.2-5 on the production server from source. This has not affected the results of phpinfo which still reports 6.7.7-10, in spite of convert -version returning
Version: ImageMagick 6.9.2-5 Q16 x86_64 2015-11-02 http://www.imagemagick.org
I can't figure out how to point the imagick extension to the new ImageMagick binaries. And futher I actually have no idea if the version of ImageMagick is what's causing this effect, but I have run out of other ideas and it's the only difference I can find, so it's the rabbit hole I've been jumping down for the last few hours.
Is there a way to configure the ImageMagick path in php5-imagick? Or has anyone else experienced this weird effect on (some) images and successfully solved it in some other way?
When I try to convert the first page of a PDF into JPG through PHP imagick, I get an HTTP 500 error with no log in php_errors.log.
Explanation from IIS: The FastCGI process exited unexpectedly
Error code: 0xc0000417
Two files are created in C:\Windows\Temp, the first one is the PDF read; the other is 0 Kb length.
I am able to perform command line conversions with ImageMagick (convert some.pdf some.jpg). So, ImageMagick and GhostScript are running fine. Also, I am able tho convert between JPG and GIF from PHP scripts.
PHP code:
$im = new Imagick();
$im->setResolution(300,300);
$im->readimage('poster.pdf[0]');
$im->setImageFormat('jpeg');
$im->writeImage('poster.jpg');
$im->clear();
$im->destroy();
My environment:
Windows 7 Professional 64 bit
IIS 7.5
PHP 5.3.6 NTS VC9 via FastCGI
PHP imagick extension v.3.1.2 (5.3 NTS VC9 x86, from PECL)
ImageMagick-6.7.7-0-Q16-windows-dll (x86)
GhostScript 9.07 win32 (x86)
Microsoft Visual C++ 2008 redistributable x86
Path to ImageMagick added to PATH environment variable
Permissions granted to IUSR and IIS_IUSRS in folders C:\Windows\Temp and C:\imagemagick.
So, can anyone give me some guidance to debug this error and have the thing running?
As Danack suggested, ImageMagick MUST be downloaded from the same place imagick was. Compiler version and processor architecture must be respected to match the ones of PHP and GhospScript (in my case, VC9, x86).
Nevertheless, not all versions of ImageMagick availables at this repository appear to be consistent with those of imagick and / or GhostScript. In my case, the combination that finally worked (at second attempt) was:
imagick 3.1.2
ImageMagick 6.8.8
GhostScript 9.07
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
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.