Windowphpimagick failed to save the image. problem: in windows, imagick: writeImage () is successful. the image fails, and no return value is returned. why? But in linux, it is successful.
However
$ This-> image = new Imagick ($ path); // $ path stores the image path;
...... (Set some attributes of the image, and the code is omitted)
Method 1: $ this-> image-> writeImage ($ path); unsuccessful
Method 2: file_put_contents ($ path, $ this-> image); succeeded
Imagick: ImageMagick-6.8.7-7-Q16-x86-dll.exe
Php version: 5.4.16
Please tell us why
Reply to discussion (solution)
Imagick is troublesome. If PHP and imagick versions have compatibility problems, you must find a suitable version.
If only
Method 1: $ this-> image-> writeImage ($ path); unsuccessful
Method 2: file_put_contents ($ path, $ this-> image); succeeded
It's not about ImageMagick, but about you!
1. the path may contain Chinese characters.
2. possible paths are long path names with spaces
3. the relative path may be treated as an absolute path.
Thanks to the moderator's prompt, the problem is indeed on the road.
Change path strength to absolute path.