Imagick: cannot open file

When you just call the Imagick class:

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

I get an error message:

Fatal error: ImagickException exception with the message 'cannot 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 at ... /imag.php

I checked the available memory according to another post here, and that is fine!

+3
source share
1 answer

Use the full path to the image, for example:

 $image = new Imagick($_SERVER['DOCUMENT_ROOT'] . '/images/magick/atmsk.png'); 
+17
source

Source: https://habr.com/ru/post/971486/


All Articles