问题描述
我具有使用Imagick扩展名更改Image DPI的功能:
I have this function to change Image DPI using Imagick extension:
<?php
// create an image copy
$image=new Imagick("D:/xampp/htdocs/extra/1270006212-Z3BFN9J.jpg");
$image->readImage("D:/xampp/htdocs/extra/1270006212-Z3BFN9J.jpg");
$image->setImageFileName("D:/xampp/htdocs/extra/ANC.jpg");
$image->writeImage();
?>
只要在readImage函数中到达程序,浏览器就会停止运行并给我错误:
Whenever program reached in readImage function, browser stops running and give me error:
连接已重置
页面加载时重置了与服务器的连接.
The connection to the server was reset while the page was loading.
该站点可能暂时不可用或太忙.再尝试几次 片刻. 如果无法加载任何页面,请检查计算机的网络 联系. 如果您的计算机或网络受到防火墙或代理的保护,请确保 允许Firefox访问Web.
The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
我不知道这是什么问题.我正在使用XAMPP 1.7.7,PHP 5.3.8,Imagick版本2.3.0-rc3.请帮助我.
I dont know what is the problem. I am using XAMPP 1.7.7, PHP 5.3.8, Imagick Version-2.3.0-rc3. Please help me in this.
谢谢
推荐答案
[您没有提到要在哪个平台上运行,但我会假设它是某种Windows的路径.]
[You don't mention what platform you're running on but I'll presume from the paths it's some kind of Windows.]
该代码还可以,但是在某些版本的Imagick上,Windows上的readImage()存在问题(请参见 https://bugs.php.net/bug.php?id=59594 ),并且在Windows上使用高于6.6.4.0的ImageMagick版本时,由于针对VC10和其他组件使用VC9(http://stackoverflow.com/questions/8608426/imagick-crash-with-php-5-3).阅读 http://valokuva.org/?page_id=50 上的线程(Imagick开发人员的博客)并在注释中指出Windows是不受支持的平台.
The code is OK but there are problems with readImage() on Windows with some versions of Imagick (see https://bugs.php.net/bug.php?id=59594) and there are also general problems when using versions of ImageMagick above 6.6.4.0 on Windows as it is compiled against VC10 and the other components use VC9 (http://stackoverflow.com/questions/8608426/imagick-crash-with-php-5-3). Read the thread on http://valokuva.org/?page_id=50 (the Imagick developer's blog) and note in the comments that Windows is an unsupported platform.
我得出的结论是,根本不可能在Windows 7 x64上运行Imagick,而是安装了在Oracle VirtualBox下运行的Ubuntu服务器来进行Imagick开发.一直很好.
I came to the conclusion that it wasn't possible to run Imagick on Windows 7 x64 at all and installed an Ubuntu server running under Oracle VirtualBox to do Imagick development. That's been working nicely.
这篇关于使用readImage函数时出错(Imagick)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!