简体   繁体   中英

File won't save with Imagick

I have not changed anything on my website, but recently when users use the form for uploading an image, the file won't save with Imagick. There is no error. Here is a snippet:

$file = $_FILES['foto']['tmp_name'];

$im = new Imagick($file);

$im->setImageBackgroundColor(new ImagickPixel("white"));
$im->setFormat ("jpg");
$im->cropThumbnailImage(100,100); 
$im->writeImages('/path/to/thumb0000.jpg',false);

Edit: Thanks to TK, I found the following message in the error-log:

PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - libMagickWand.so.2: can not open shared object file: No such file or directory in Unknown on line 0. 

Solved: I have installed the package php-pecl-imagick and everything works again!

Your write destination is absolute and unlikely writable by the www user.

 $im->writeImages('/path/to/thumb0000.jpg',false);

Check your actual path and make sure it exists, and you can write there

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM