• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Question Uncaught ImagickException: unable to open file /tmp/magick-19187PLk9nfNAo48O

pvl

New Pleskian
Hey!
When trying to process an image already uploaded to the server using Imagick, I get the error Uncaught ImagickException: unable to open file /tmp/magick-19187PLk9nfNAo48O. Tell me, what could be causing it?
thank
 
If I remember correctly, you cannot directly work on temporary files. I think the reason was that once a file is uploaded and nothing else is done with it, it is auto-removed from the tmp location. For that reason you are seeing the "unable to open". The file is no longer there to open it.

Instead, after the upload first move the file into a place inside your subscription where you could equally well open it with an editor, then apply the imagick functions to that file.
 
If I remember correctly, you cannot directly work on temporary files. I think the reason was that once a file is uploaded and nothing else is done with it, it is auto-removed from the tmp location. For that reason you are seeing the "unable to open". The file is no longer there to open it.

Instead, after the upload first move the file into a place inside your subscription where you could equally well open it with an editor, then apply the imagick functions to that file.
Hi!
Not certainly in that way. The file has been uploaded to the server for a long time and is in the subscription. I tried to set the value {WEBSPACEROOT} {/} {:} {TMP} {/}: / tmp in the php settings for this subscription in the open_basedir field, but the problem was not solved.
 
That is, there is a code
Code:
(43)        $this->im = new Imagick;
(44)        $this->im->readImage($file);
The variable $ file is set
Code:
dumped from /var/www/vhosts/*******/httpdocs/wa-system/image/waImageImagick.class.php line #40:
'/var/www/vhosts/*****/httpdocs/wa-data/protected/shop/products/84/07/784/images/3100.jpg'
And on line 44 the execution is interrupted
[error] 23164#0: *722953 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ImagickException: unable to open file `/tmp/magmagick-9444K1dDg69Y4DtY': No such file or directory @ error/constitute.c/ReadImage/544 in /var/www/vhosts/****/httpdocs/wa-system/image/waImageImagick.class.php:44
Stack trace:
#0 /var/www/vhosts/******/httpdocs/wa-system/image/waImageImagick.class.php(44): Imagick->readimage('/var/www/vhosts...')
............
Code:
/var/www/vhosts/******/httpdocs/wa-data/protected/shop/products/84/07/784/images# ls -l

-rw-r--r-- 1 ****** psacln 480975 Aug  9  2020 3099.jpg
-rw-r--r-- 1 ****** psacln  18132 Aug  9  2020 3100.jpg
 
UPD
The file 3100.jpg is in webp format despite the jpg extension. Apparently, need to tweak Imagick itself or install an additional library?
 
Back
Top