Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Imagick: unable to open file

Tags:

php

imagick

When simply calling the Imagick class:

$image = new Imagick('/images/magick/atmsk.png');

I get the error message:

Fatal error: Uncaught exception 'ImagickException' with message 'unable to open file `/images/magick/atmsk.png' @ png.c/ReadPNGImage/2889' in .../imag.php:4 Stack trace: #0 .../imag.php(4): Imagick->__construct('/images/magick/...') #1 {main} thrown in .../imag.php

I have checked memory available as per another posting here and that is ok!

like image 839
Dzseti Avatar asked Mar 16 '13 07:03

Dzseti


1 Answers

Use the full path to the image, for example:

$image = new Imagick($_SERVER['DOCUMENT_ROOT'] . '/images/magick/atmsk.png');
like image 168
gmartellino Avatar answered Oct 08 '22 01:10

gmartellino