Unable to load images after Imagick update #850

Open
opened 2026-10-05 00:20:51 +02:00 by adam · 2 comments
Owner

Hi, I just performed some system updates today and now I am getting these errors in my logs:

"PHP message: PHP Fatal error: Uncaught ImagickException: unable to open image `././upload/2019/01/20/20190120213924-8e04e925.jpg': No such file or directory @ error/blob.c/OpenBlob/2875

and of course images are not loading.

This is my Imagick version: php73-pecl-imagick-3.4.3_3

and this is the Piwigo environment:

Piwigo 2.9.4
Operating system: FreeBSD
PHP: 7.3.1 (Show info) [2019-01-21 06:57:08]
MySQL: 5.5.5-10.0.37-MariaDB [2019-01-21 06:57:08]
Graphics Library: ImageMagick 6.9.10-22

Is there anything in Piwigo that can be done to fix this or is this simply a bug upstream?

Hi, I just performed some system updates today and now I am getting these errors in my logs: "PHP message: PHP Fatal error: Uncaught ImagickException: unable to open image `././upload/2019/01/20/20190120213924-8e04e925.jpg': No such file or directory @ error/blob.c/OpenBlob/2875 and of course images are not loading. This is my Imagick version: php73-pecl-imagick-3.4.3_3 and this is the Piwigo environment: Piwigo 2.9.4 Operating system: FreeBSD PHP: 7.3.1 (Show info) [2019-01-21 06:57:08] MySQL: 5.5.5-10.0.37-MariaDB [2019-01-21 06:57:08] Graphics Library: ImageMagick 6.9.10-22 Is there anything in Piwigo that can be done to fix this or is this simply a bug upstream? <!-- github-sync-id:401217613 -->
Author
Owner

I was hit by this bug to

I was hit by this bug to <!-- github-comment-id:546882453 -->
Author
Owner

Seems image magic has an issue processing the non expanded / sanitized file path location. There was an old comment from 2014 about using php->realpath to qualify the full path before sending over to the external library. The line numbers have changed since 2014, but similar mod seemed to fix my problems. I am FreeBSD based and have the exact problems listed above.
Fix from 2014:
86: $class = 'image_'.$this->library;
87: $source_filepath = realpath($source_filepath);
88: $this->image = new $class($source_filepath);

and

496: file_put_contents($destination_filepath, '');
497: $destination_filepath = realpath($destination_filepath);

https://piwigo.org/forum/viewtopic.php?id=23795

I applied the changes to the same function locations in the most recent version. Seems to fix it. If I have time to make a pull, I will.

Seems image magic has an issue processing the non expanded / sanitized file path location. There was an old comment from 2014 about using php->realpath to qualify the full path before sending over to the external library. The line numbers have changed since 2014, but similar mod seemed to fix my problems. I am FreeBSD based and have the exact problems listed above. Fix from 2014: 86: $class = 'image_'.$this->library; 87: $source_filepath = realpath($source_filepath); 88: $this->image = new $class($source_filepath); and 496: file_put_contents($destination_filepath, ''); 497: $destination_filepath = realpath($destination_filepath); https://piwigo.org/forum/viewtopic.php?id=23795 I applied the changes to the same function locations in the most recent version. Seems to fix it. If I have time to make a pull, I will. <!-- github-comment-id:932625020 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#850