Faryal Khan Faryal Khan - 1 year ago 146
PHP Question

Imagick not working

I am working on creating thumbnail image from the first page of pdf file. I almost tired every solution available on the web to make ImageMagick running but I still get the following error

Fatal error: Class 'Imagick' not found in C:\wamp\www\mediabox\application\controllers\cron.php on line 153

what I have done so far.

  1. Installed GPL Ghostscript

  2. Installed ImageMagick-6.7.6-Q16

  3. Downloaded and copied the php_imagick.dll file in ext folder of my php installation.

  4. Added extension=php_imagick.dll line to my php.ini file.

  5. Restarted the apache server and windows many times :)

  6. I am using codeigniter framework.

  7. Php 5.3.10, apache 2.2.21, mysql 5.5.20, wamp 2.2 and win 7

On my localhost page in the loaded extensions category 'Imagemagick is not listed'

The code I have written is as

$image = explode('.', $filename_new);
$image_name = 'files/import/' . $ftp_upload["path"] ."/". $image[0] .".jpg";
//exec("convert -colorspace RGB -geometry 300x400! -density 200 " .$pdf_file."[0] ". $image_name);
$img = $image[0].".jpg" ;
$im = new Imagick($img);
$im->thumbnailImage(100, null);
$im->writeImage( 'files/import/' . $ftp_upload["path"] ."/".$img);

The exec command create images but it is very slow I want to create thumbnail images using Imagick class and I hope it will be faster as compared to exec and convert thingy.

Any ideas what should I do to make the Imagick class available for my php ?


F21 F21
Answer Source

I am not sure where you got your binaries from, but it seemed like something I experienced about a month ago. Some of the binaries I tried would show up in phpinfo(), but refused to work, whereas others wouldn't even show in phpinfo().

I then just went ahead and compiled my own binaries as per my question here.

I just went and compiled those binaries for you. They are for x86, compiled with VC9 and there are threadsafe and non-threadsafe versions. The version is 3.1.0RC1 (latest).

You can download them here: http://min.us/mtg0Z66BI

Let me know if it works for you :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download