[英]imagick unable to read the file
我在文件中有以下php代码:
$figloc = $_GET['figrl'];
try
{
$image = new Imagick($figloc);
$image->setImageFormat("jpg");
$image->setImageColorSpace(5);
$image->writeImage("temp.jpg");
}
catch(Exception $e)
{
echo $e->getMessage();
}
和这样的jQuery脚本:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
figurelocation='temp.jpg';
var fightmlstring='<img src=\"'+figurelocation+'\">';
$('.figuredisplay').append(fightmlstring);
});
Figuredisplay是一个div元素。 $ figloc值是磁盘上映像的绝对地址,例如“ /home/abc/def/ghi/jkl.tiff”。 从适当的链接打开该php文件时,显示错误消息“ imagick无法打开文件/home/abc/def/ghi/jkl.tiff”。 绝对地址会引起问题吗?
另外,当我将特定的tiff文件复制到目录中时,要查看绝对地址是否有问题,imagick会着手读取该文件,但无法创建temp.jpg。
unable to open image `/var/www/temp.jpg @ error/blob.c/OpenBlob/2489
谁能指出我做错了什么?
好的,我知道了问题所在。 这真是一个愚蠢的。 我写这篇文章是为了让其他面临相同问题的人受益。
代替
$image = new Imagick($figloc);
写:
$abc= substr ( $figloc , 1, strlen($figloc)-2);
$image = new Imagick($figloc);
因此,figloc字符串中的单引号被删除。 真傻:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.