diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-11-09 14:42:24 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-11-09 14:42:24 -0400 |
commit | aa30c888ea2307931c555db474d709f520c551a8 (patch) | |
tree | b23042b5b575862d83f401b5fa21f8b45f7988ff /src/content/dependencies/image.js | |
parent | e71230340181a3b7b38ff05ba23504b264f5b26c (diff) | |
parent | b62622d3cd8ffe1ed517ceb873d9352943c4a601 (diff) |
Merge branch 'preview' into listing-tweaks
Diffstat (limited to 'src/content/dependencies/image.js')
-rw-r--r-- | src/content/dependencies/image.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js index 6c0aeecd..8aa9753b 100644 --- a/src/content/dependencies/image.js +++ b/src/content/dependencies/image.js @@ -77,6 +77,11 @@ export default { originalSrc = ''; } + // TODO: This feels janky. It's necessary to deal with static content that + // includes strings like <img src="media/misc/foo.png">, but processing the + // src string directly when a parts-formed path *is* available seems wrong. + // It should be possible to do urls.from(slots.path[0]).to(...slots.path), + // for example, but will require reworking the control flow here a little. let mediaSrc = null; if (originalSrc.startsWith(to('media.root'))) { mediaSrc = @@ -160,7 +165,7 @@ export default { // which is the HTML output-appropriate path including `../../` or // another alternate base path. const selectedSize = getThumbnailEqualOrSmaller(slots.thumb, mediaSrc); - thumbSrc = originalSrc.replace(/\.(jpg|png)$/, `.${selectedSize}.jpg`); + thumbSrc = to('thumb.path', mediaSrc.replace(/\.(png|jpg)$/, `.${selectedSize}.jpg`)); const dimensions = getDimensionsOfImagePath(mediaSrc); availableThumbs = getThumbnailsAvailableForDimensions(dimensions); |