php Imagick:无法打开文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15446687/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Imagick: unable to open file
提问by Dzseti
When simply calling the Imagick class:
当简单地调用 Imagick 类时:
$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
致命错误:未捕获的异常 'ImagickException' 带有消息 '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} 扔进.../imag.php
I have checked memory available as per another posting here and that is ok!
我已经根据此处的另一篇文章检查了可用内存,没关系!
回答by gmartellino
Use the full path to the image, for example:
使用图像的完整路径,例如:
$image = new Imagick($_SERVER['DOCUMENT_ROOT'] . '/images/magick/atmsk.png');

