问题
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();
?>
Whenever program reached in readImage function, browser stops running and give me error:
The connection was reset
The connection to the server was reset while the page was loading.
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.
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.
Thanks
回答1:
[You don't mention what platform you're running on but I'll presume from the paths it's some kind of 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.
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.
来源:https://stackoverflow.com/questions/9870161/error-in-using-readimage-function-imagick