Ivo Kuzmanic
Ivo Kuzmanic

Reputation: 11

Imagick doesn't work in php

I have a problem. I have installed Image Imagick software, this file:

ImageMagick-6.8.4-6-Q16-x86-dll.exe

And my php code goes like this:

<?php
    $gume = 'svg/EC_tyre_label.svg';
    $im = new Imagick();
    $svg = file_get_contents($gume);

    $im->readImageBlob($svg);
    /*png settings*/
    $im->setImageFormat("png24");
    $im->writeImage('svg/EC_tyre_label.png');
    $im->clear();
    $im->destroy();


?>
<body>
<img src="svg/EC_tyre_label.png" />
</body>

My version of php is 5.3.8 and i am using xampp version 1.7.7. When i open it in the browser, I get this error:

Fatal error: Class 'Imagick' not found in C:\xampp\htdocs\SVG_antonio\index.php on line 9

Does anyone know how to solve this problem?? Cheers.

Upvotes: 1

Views: 5944

Answers (2)

Robert G.
Robert G.

Reputation: 61

Is "Imagick" listed as extension, when you call phpinfo() ?! That's something you need to make sure first, before trying to create any imagick instance.

If it is listed as extension, make sure you are not within some namespace, being the reason why plain "imagick" cannot be found.

Try (pay attention to the backslash!):

$im = new \Imagick();

EDIT: If it is not listed, try the non-thread safe version, and always make sure your extension path within php.ini is set correctly. You might need absolute path-values and use "/" instead of "\" or the other way round for extension-dll-paths.

I cannot post screen captures due to my low reputation, but have google search for images with "phpinfo imagick", you'll find screenshots of how the phpinfo-section looks, if imagick was loaded successfully.

Upvotes: 2

danielrsmith
danielrsmith

Reputation: 4060

Download ImageMagick compiled for PHP5.3 with Visual C++ 9 - you will need the TS (thread safe versions). Here is another site that might have the correct binaries for you:

http://valokuva.org/?page_id=50

Upvotes: 0

Related Questions