Store figure image derivative dimensions and paths on derivatives property#1235
Open
cbutcosk wants to merge 22 commits into
Open
Store figure image derivative dimensions and paths on derivatives property#1235cbutcosk wants to merge 22 commits into
derivatives property#1235cbutcosk wants to merge 22 commits into
Conversation
transformations property with computed paths for figure image assetstransformations property
Member
|
@cbutcosk I ran this through my normal QA process and everything is looking good.
|
776caee to
7b8982a
Compare
transformations propertyderivatives property
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the figure media model to make it easier to use image derivatives generated during publication builds. It moves path and dimension metadata handling into the higher-order
FigureMediaclass, allowing for more correct re-use of the paths in components and adding long-missingheightandwidthattributes to quire's figureimgtags, improving page responsiveness.Overview of changes:
derivativesproperty to themedia()data shim onFigureMediaclass.derivativescontains an object with derivative transformation names as keys (full, thumbnail, etc) and result metadata (height, width, and asset paths) objects. A full list of transforms is inpackages/11ty/_plugins/figures/iiif/config.js.FigureMediainstances serialized as JSON:{ "derivatives": { "full": { "dimensions": { "height": 1000, "width": 1000 } "paths": { "absolute": "/_assets/images/XXX.jpg", "internal": "/subpath/_assets/images/XXX.jpg", "uri": "https://example.org/subpath/_assets/images/XXX.jpg" } } } }pathscontains asset paths for derivatives:absolute- relative to the the root of the publication hostnameinternal- relative to the root of the publication (ie, paths that are safe to use in fragments that will be processed by the asset bundling plugin)uri- with scheme, hostname, and portdimensionscontains theheightandwidthfor the derived imageFigureMediamethods. The switching dispatch of thefigureElementcomponent is also refactored so that control flow branches within the static figure tag are reduced from several branches to one branch with a varying argument.imageTagand the print output mode offigureImagecomponents.snakeCaseToCamel, for converting transformation names within in the IIIF configuration that are in snake case to the camel case used by quire's data APIs (and enforced by linting, etc).srcbut not an internally-served IIIF URL (eg, images on a CDN) use the src URL for all paths.Affected Issues:
globalData.figuresMedia[].derivatives.thumbnail.paths, etc.