When using external file schemes such as Amazon S3 there are issues with image style derivatives not being created. This issue and solutions for it have been discussed: #1372736: Improve image styles handling for external FileStreamWrappers, #1358896: Flexible scheme and URI for image derivatives, and #987846: Switching file storage to anything other than public/private breaks image styles. An additional concern of mine, not addressed by these issues, is that I'd rather be able to explicitly declare where the derivative files are stored. I'd like to setup an autoscaling group of web servers which use S3 only for storage of the original images, and local instance storage for derived files. This is currently not possible because image_style_path() sets the scheme for the image style path to match the original image, or use the default file scheme if a path is passed to this function rather than a URI.

I propose that a setting be added to optionally override this behavior and specify where image style derivatives should be stored.

#1 derived-images-using-different-scheme-1821166-1.patch2.18 KBbenshell
PASSED: [[SimpleTest]]: [MySQL] 46,198 pass(es). View


benshell’s picture

2.18 KB
PASSED: [[SimpleTest]]: [MySQL] 46,198 pass(es). View

Here is a patch to add this setting.

claudiu.cristea’s picture

Status: Needs review » Closed (duplicate)

@benshell, your approach is too particular and assume that all derivatives will use the same scheme.

There's another approach that allows extending of \Drupal\image\Plugin\Core\Entity\ImageStyle in order to provide alteration of derivatives stream wrapper, path and even access: #2027423: Make image style system flexible.

I'm marking this as a duplicate.