我在一个文件中有以下 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
谁能指出我做错了什么?