Problem/Motivation
If you are storing your images inside a module or theme, having to reference the entire image path will cause problems in cases where the path from the root of the site is not fixed. Examples would be:
- You want to have a copy of the module/theme containing the image in an "overriding" folder, for development, or in a multi-site environment where you have one or more sites that should get a different version/branch than the others
- Server has different path structure than your development environment
- Different domain names have different path structures
While technically it is possible to create a different configuration for each environment, for maintainability it would be nice if they could all use the same configuration.
Steps to reproduce
Put an image inside a module/theme in sites/all/modules. Reference the path to that image. Copy the module/theme into sites/sitename/modules and replace the image file with something that looks different but has the same filename. Note that, because you are using an exact path, the browser still shows the version of the image from the original folder.
Proposed resolution
Add an "image path base" field to the configuration, with "use as shown" as the default (allowing full backwards compatibility), that lets you select a module or a theme to use as the base path for the image URL.
Remaining tasks
I have a working prototype of this - it will be turned into a patch shortly.
User interface changes
Adds an image path base field, which defaults to "use as shown" for backwards compatibility.
API changes
n/a
Data model changes
Adds an image path base field.