Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glide image rendering service improvements #2422

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Conversation

ifox
Copy link
Member

@ifox ifox commented Feb 6, 2024

This non-breaking PR introduces new configuration and environment variables to help with Glide's integration with remote disks like S3, media library default ACL's, SVGs and transparent PNGs/GIFs support:

  • GLIDE_USE_SOURCE_DISK: specify that the disk name provided in GLIDE_SOURCE_DISK should be used as the Glide source

  • GLIDE_SOURCE_DISK: name of the disk to use as source, defaults to twill_media_library, which is an S3 disk when MEDIA_LIBRARY_ENDPOINT_TYPE=s3

  • GLIDE_USE_CACHE_DISK: specify that the disk name provided in GLIDE_CACHE_DISK should be used as the Glide cache

  • GLIDE_CACHE_DISK: name of the disk to use as cache, defaults to twill_media_library, which is an S3 disk when MEDIA_LIBRARY_ENDPOINT_TYPE=s3

  • GLIDE_USE_STREAMED_RESPONSE_FOR_ORIGINAL_MEDIA: Glide doesn't support SVG rendering (with both gd and imagick drivers), so we previously allowed an array of extension to bypass the Glide rendering. The problem is that by default the media library uploads are set to private ACL on S3, so the S3 URL returned doesn't work. With this new setting, SVG will be returned as a streamed response from the remote disk in the Glide controller

  • GLIDE_USE_TEMPORARY_URL_FOR_ORIGINAL_MEDIA: Alternatively, with compatible Flysystem disks, like S3, it is now possible to return a temporary URL with an expiring token instead of a URL that would return a 403 AccessDenied when twill.media_library.acl is set to private. Of course, be mindful that if you are using a CDN or any sort of cache where you cache your HTML responses, you should make sure to set GLIDE_TEMPORARY_URL_EXPIRATION to a longer duration than your cache TTL. If not, you are going to end up with expired temporary URLs in your cached HTML responses.

  • GLIDE_TEMPORARY_URL_EXPIRATION: Expiration in seconds for temporary URLs

  • GLIDE_KEEP_TRANSPARENCY: Preserves transparency for PNG and GIF files, while keeping the default JPG format for everything else

Introduced new configuration and environment variables to help with Glide's integration with remote disks like S3, media library default ACL's, SVGs and transparent PNGs/GIFs support:

- GLIDE_USE_SOURCE_DISK: specify that the disk name provided in GLIDE_SOURCE_DISK should be used as the Glide source

- GLIDE_SOURCE_DISK: name of the disk to use as source, defaults to `twill_media_library`, which is an S3 disk when `MEDIA_LIBRARY_ENDPOINT_TYPE=s3`

- GLIDE_USE_CACHE_DISK: specify that the disk name provided in GLIDE_CACHE_DISK should be used as the Glide cache

- GLIDE_CACHE_DISK: name of the disk to use as cache, defaults to `twill_media_library`, which is an S3 disk when `MEDIA_LIBRARY_ENDPOINT_TYPE=s3`

- GLIDE_USE_STREAMED_RESPONSE_FOR_ORIGINAL_MEDIA: Glide doesn't support SVG rendering (with both gd and imagick drivers), so we previously allowed an array of extension to bypass the Glide rendering. The problem is that by default the media library uploads are set to `private` ACL on S3, so the S3 URL returned doesn't work. With this new setting, SVG will be returned as a streamed response from the remote disk in the Glide controller

- GLIDE_USE_TEMPORARY_URL_FOR_ORIGINAL_MEDIA: Alternatively, with compatible Flysystem disks, like S3, it is now possible to return a temporary URL with an expiring token instead of a URL that will return a 403 when `twill.media_library.acl` is set to `private`

- GLIDE_TEMPORARY_URL_EXPIRATION: Expiration in seconds for temporary URLs

- GLIDE_KEEP_TRANSPARENCY: Preserves transparency for PNG and GIF files, while keeping the default `JPG` format for everything else
@ifox ifox merged commit 8cfe205 into 3.x Feb 6, 2024
10 of 12 checks passed
@ifox ifox deleted the glide-service-improvements branch February 6, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant