Problem/Motivation
At the moment it is only possible to create an image derivative starting from a file URI. It would be good to have the possibility to do it from an already instantiated Image object. template_preprocess_image_style_preview() is e.g. getting an Image object, then handing over its source path to createDerivative() which just opens another Image instance for the same file. Also, in contrib you may want to create an Image programmatically and apply an image style to it without having to flush it to disk before.
Proposed resolution
Add two methods to ImageStyle, apply
and applyAndSave
. Final names of the methods to be decided (see comments #17.4, 21, 22, 23).
Remaining tasks
- decide on how to introduce the two new methods, new interface or no interface (see comment #25)
- decide on the methods' names (see comments #17.4, 21, 22, 23)
- draft change record
User interface changes
None
API changes
Two methods added.