- πΊπΈUnited States jsutta United States
Hello,
On the site I'm working on currently, we use the s3fs module to take over the public/private file system and store files in an S3 bucket, with the temporary file directory still local (see https://www.drupal.org/project/s3fs/issues/3325298 β for why the temporary directory should remain local).
As of today we're using Drupal 10.0.9, version 8.x-1.0-beta1 of Media Thumbnails, and version 2.0.0-beta2 of this module. On my site I have a requirement to generate thumbnails of PDF files as they're uploaded, which is where our use of this module originated. However, with ImageMagick's limitation around stream wrappers I had to find a solution for our site. Now that my patch is working and I've completed functional testing, I'm attaching it to this issue since it was created first and may be of use to others. It's based on a patch from the ImageMagick module's issue queue ( Allow ImageMagick to work with remote streamwrappers (s3) β ). The patch was originally written for Drupal 7, so I had to update it for Drupal 8/9/10.
Some notes from my experience setting up this module:
- Make sure to install ghostscript so ImageMagick can read PDFs (see https://www.php.net/manual/en/imagick.requirements.php for more information)
- If thumbnails aren't being generated and you see a message like this in the log:
cache resources exhausted `/tmp/magick-fCoRMvS5SPEH7_klIKyId3VgmNM24XZL346' @ error/cache.c/OpenPixelCache/4095
, you need to increase ImageMagick's memory allocation. To do this, find ImageMagick'spolicy.xml
file (for reference, mine is located at/etc/ImageMagick-6/policy.xml
) and change the following settings, depending on your needs:<policy domain="resource" name="memory" value="256MiB"/>
- I increased my value to 2GiB<policy domain="resource" name="disk" value="1GiB"/> - I increased my value to 2GiB
- If thumbnails aren't being generated and you see a message like this in the log:
attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/421
, you need to change ImageMagick's security policy to allow it to access PDFs (see https://stackoverflow.com/questions/52998331/imagemagick-security-policy...). To do this, find ImageMagick'spolicy.xml
file (for reference, mine is located at/etc/ImageMagick-6/policy.xml
) and uncomment the line that looks like this:<policy domain="module" rights="read|write" pattern="{PS,PDF,XPS}" />
(the rights attribute may be set only to read; if it is, update it to read|write).
- πΊπΈUnited States jsutta United States
Rerolled the patch and incorporated the change from https://www.drupal.org/project/media_thumbnails_pdf/issues/3414282 π Convert CMYK colors to RGB for generated thumbnail RTBC due to encountering CMYK/RGB colorspace issues on our own site.
-
renrhaf β
committed c7b0b35a on 2.x
Issue #3193086 by jsutta, renrhaf: stream wrapper support
-
renrhaf β
committed c7b0b35a on 2.x
- Status changed to Fixed
2 months ago 7:29am 9 September 2024 - π«π·France Renrhaf π Strasbourg π¦π¦
Fixed in 2.x version, thank you all !
Automatically closed - issue fixed for 2 weeks with no activity.