I'm trying to create a thumbnail of an image, however, I can display it just fine, but cannot save it.
For example:
$image = new Imagick("photo.png");
$image->thumbnailImage(100, 0);
header("Content-Type: image/png");
echo $image;
This will in fact display my image in its thumbnailed form. But if I instead try to save it using $image->writeImage("thumb_photo.png")
the script appears to stop (I confirmed this just by putting echo Hello
or whatever afterwards) and no files have been created.
I'm using this on a server with Debian Wheezy, nginx, and PHP setup. The directory and PHP files themselves are readable, writable and have execute permissions for both the images and PHP files themselves. The imagick module version is 3.10. The PHP version is 5.4.
If someone can tell me what the problem could be I would appreciate it.
EDIT: After getting the exception, I am presented with WriteBlob Failed "thumb_photo.png" @ error/png.c/MagickPNGErrorHandler/1728
.
另一件事,显然如果我将输出从“thumb_photo.png”更改为“photo.png”,它可以工作,但会覆盖我的图像,我怎么能解决这个问题以及两个为什么它会让我覆盖我的图像而不是创建一个新的一?