Reputation: 4227
First of all, I used ImageMagick in combination with the Imagick PHP5 extension for a while with no issues at all, untill I accidentally removed GhostScript. Since then I'm trying to get it back working again to no avail.
After reinstalling everything, ImageMagick is able to convert PDF to JPEG. However I can't find gs
in the DELEGATE list when I run convert -list configure
. Still when I run convert sample.pdf[1] sample.jpg
it works perfectly. However, when I reinstalled the php5-imagick extension through sudo apt-get install php5-imagick
it throws an error when I try to convert PDF to images.
Fatal error: Uncaught exception 'ImagickException' with message 'no decode delegate for this image format
upload/guide.pdf' @ error/constitute.c/ReadImage/533.`
It was thrown by the following code:
<?php
//header("Content-type: image/jpeg");
$img = new imagick("upload/guide.pdf[1]");
$img->setImageFormat("jpg");
echo $img;
?>
I can't see where the problem is, as ImageMagick itself is just working fine I suppose it's Imagick that doesn't interact with ImageMagick well.
Upvotes: 1
Views: 2468
Reputation: 4227
I fixed the problem by not installing Imagick through the Ubuntu repository. When I ran sudo apt-get autoremove php5-imagick
and tried to install it through pecl, it threw an error and said that Imagick was already installed (which was weird, because I uninstalled it and restarted apache).
So I uninstalled it through sudo pecl uninstall imagick
and then reinstalled it using sudo pecl install imagick
and then added extension=imagick.so
to php.ini, and restarted apache again. Now everything works again. Hopefully this will help someone having the same problem.
Upvotes: 1