Add stage proxy image toolkit and fetch event

Created on 22 June 2021, almost 3 years ago
Updated 31 January 2023, over 1 year ago

Problem/Motivation

I was debugging an issue with focal_point module where the focal point was not being set within preview screen.

This was due to no file being found by Drupal's ImageToolkit class `GdImageToolkit`

Steps to reproduce

Install focal_point module and edit a media item (where you do not have a local file), set the preview and note how the focal point saves to 0,0 rather than where you selected it to save. It defaults to 0,0 because it does not find a width or a height on the image (because there was no image to get this data from).

Proposed resolution

I note there is work to create a stream wrapper override this attempts to find a solution via another avenue with extending the GDImageToolkit class which overrides the GDImageToolkit::parseFile (the method that gets the preload data of a file which is used for getting width, height and other), in that if a file is not found it triggers a new Event a 'Fetch Event' which in turn fetches the file from the remote server, then it rechecks to see if the file now exists.

User interface changes

The new image toolkit needs to be configured at: /admin/config/media/image-toolkit

API changes

1. Added extended image toolkit
2. Added new fetch event to allow fetching of files outside of the onRequest event handling, this is utilised in the above image toolkit and reshuffled the existing ProxySubscriber to handle this new event.

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia RichardGaunt Melbourne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024