« get me outta code hell

content, client: image-overlay: set thumb aspect ratio - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-03-20 18:08:48 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-03-20 18:09:13 -0300
commita42b51cbe00c765981a53918f7532d67c4b650ad (patch)
tree7ac6d68cf927884a31dadeb0cac948ca44714832 /src/content
parent5ee821e53b683e8375e771dd7c6bfb219b2c573a (diff)
content, client: image-overlay: set thumb aspect ratio
Although the thumbnail image width automatically matches
the width of the main image, the height by default will
be a multiple of the thumbnail's own height, which may
result in a mismatched aspect ratio due to the much
lower accuracy of thumbnail intrinsic dimensions.
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/image.js4
-rw-r--r--src/content/dependencies/linkPathFromMedia.js2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index 8a446c39..bc268ec1 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -224,7 +224,6 @@ export default {
 
       const originalDimensions = getDimensionsOfImagePath(mediaSrc);
       const availableThumbs = getThumbnailsAvailableForDimensions(originalDimensions);
-      const originalLength = Math.max(originalDimensions[0], originalDimensions[1]);
 
       const fileSize =
         (willLink && mediaSrc
@@ -235,8 +234,7 @@ export default {
         fileSize &&
           {'data-original-size': fileSize},
 
-        originalLength &&
-          {'data-original-length': originalLength},
+        {'data-dimensions': originalDimensions.join('x')},
 
         !empty(availableThumbs) &&
           {'data-thumbs':
diff --git a/src/content/dependencies/linkPathFromMedia.js b/src/content/dependencies/linkPathFromMedia.js
index be72a113..d71c69f8 100644
--- a/src/content/dependencies/linkPathFromMedia.js
+++ b/src/content/dependencies/linkPathFromMedia.js
@@ -44,6 +44,8 @@ export default {
         fileSize &&
           {'data-original-size': fileSize},
 
+        {'data-dimensions': dimensions.join('x')},
+
         !empty(availableThumbs) &&
           {'data-thumbs':
               availableThumbs