- Issue created by @mrshowerman
- Merge request !13Issue #3509102: Pass image style to handleDerivative() and avoid fatal error... → (Merged) created by mrshowerman
- First commit to issue fork.
- 🇫🇷France sgostanyan
Additionally, I have added the use of the generic thumbnail as fallback and added a message to the logs.
- 🇮🇹Italy shura80
I think that the changes in the latest MR can be improved. I mean, the following is not a very usual situation, but I will try to describe a particular case that we spotted: imagine you are working on different environments, it can happen that if you want to "clone" one of them importing the database and then the configuration with changes you did locally, you will have the pdf entities but not the physical files on your filesystem. In this case you will receive PHP warnings because the files and the derivative images don't exist locally.
Would it be better to add also a second condition to check in the handleDerivative method of the ImageFieldFormatterElementViewTrait?
if (empty($file) || !file_exists(\Drupal::service('file_system')->realpath($file->getFileUri()))) { $this->mediaPdfThumbnailImageManager->getLogger()->warning('No file found for image id: @imageId. Using generic thumbnail instead', ['@imageId' => $imageId]); $file = $this->mediaPdfThumbnailImageManager->getGenericThumbnail(TRUE); }
- 🇫🇷France sgostanyan
Thanks for your feedback. The new changes should add a proper way to check for the existence of files with both local and remote storage system.
- Issue was unassigned.
- Status changed to Needs review
2 months ago 12:07pm 8 May 2025 - 🇫🇷France sgostanyan
Please anyboby can confirm that changes work for all storage types ?
- 🇩🇪Germany mrshowerman Munich
Earlier today, I updated the patch we use in one of our projects to the latest version of the MR.
Looks good at first sight, but I'd like to watch it a bit longer until giving feedback here. - 🇩🇪Germany mrshowerman Munich
This has been used for a week in production now, and we didn't notice any issues.
So RTBC+1 from my side. -
mrshowerman →
committed 1446a143 on 6.1.x
Issue #3509102: Pass image style to handleDerivative() and avoid fatal...
-
mrshowerman →
committed 1446a143 on 6.1.x
-
mrshowerman →
committed 1446a143 on 6.2.x
Issue #3509102: Pass image style to handleDerivative() and avoid fatal...
-
mrshowerman →
committed 1446a143 on 6.2.x
Automatically closed - issue fixed for 2 weeks with no activity.