arvil
arvil

Reputation: 920

Cannot make Imagick detect supported format on Windows + PHP 5.6 (Xampp)

its been 3 days of research, google and frustration to make imagick work on my XAMPP box. I can get as far on making it as php module. But it cannot detect supported formats. enter image description here

As you can see, I currently have 3.1.2 installed, but I actually worked all the way from the most recent 3.4.1 and jumping from those releases tagged with stable but I just can't make it work.

When I try to run:

<?php
$handle = fopen('http://xxxxx.png', 'rb');
$img = new Imagick();
$img->readImageFile($handle);
$img->thumbnailImage(100, 0);
echo $image;

I am getting:

Uncaught exception 'ImagickException' with message 'Unable to read image from the filehandle' in xxxxx:5 Stack trace: #0 xxxxx\index.php(5): Imagick->readimagefile(Resource id #3) #1 {main} thrown in xxxxx\index.php on line 5

What I have is:

Windows 8.1 64-bit
PHP 5.6.12, x86, TS

(https://i.sstatic.net/3Xold.png)

This is what I actually have done so far, in terms of installing it:

And still can't make my PHP detect Imagick supported file formats even though they should be http://prntscr.com/b1l54u :((

Can somebody tell me what did I miss? Please?

Upvotes: 1

Views: 981

Answers (1)

Bonzo
Bonzo

Reputation: 5299

You seem to be going a bit of a convoluted route.

The method I used to install it when I had it running was:

  1. Download and install Ghostscript with an exe file
  2. Download and install imagemagick with an exe file - make sure you let it add the path to the environmental variables. You may not need this step but I wanted to use Imagemagick I'm my website and on my computer anyway.
  3. Download the Imagick dll file and put it in the recommended folder - I can not remember which now.
  4. Uncomment the Imagick option in the php.ini file. I had two or three php.ini files on my system and I did it in each one.
  5. Turned off the computer and restarted. Started XAMPP and it worked.

This only worked for a couple of installs and when I upgraded the operating system I could not get it to work due to incompatible versions of php and the Imagick.dll. If I should ever want to use Imagick I would do it on my server as the hosts installed it there for me. You can still write your code locally and test it on your production server. It is a bit of a pain but would probably be quicker/easier than trying to get Imagick working on your PC.

Out of interest I gave up with it and use Imagemagick with exec() and the command line.

Upvotes: 1

Related Questions