Imagick: unable to open file

匿名 (未验证) 提交于 2019-12-03 08:54:24

问题:

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!

回答1:

Use the full path to the image, for example:

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


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!