Closed marktaiwan closed 4 years ago
Describe the bug Upon page load, images with a dimension far smaller than the viewport is displayed using the 'large' version, instead of 'full'.
To Reproduce Steps to reproduce the behavior:
Expected behavior Expect only the 'full' version of the image to be used.
Desktop (please complete the following information):
Additional context The bug appears to be introduced in 49f0476
The function pickAndResize(elem) in image_expansion.js expects the element passed in (#image_target) to have the the 'data-image-size' and 'data-mime-type' attributes: https://github.com/philomena-dev/philomena/blob/49f0476ad84b0dea91a7a9bea9db758f45a9af84/assets/js/image_expansion.js#L62-L63 However, the attributes were added to the parent element .image-show-container instead, causing the values NaN and undefined to be assigned to the variables, leading to failing of the final check in selectFunction: https://github.com/philomena-dev/philomena/blob/49f0476ad84b0dea91a7a9bea9db758f45a9af84/assets/js/image_expansion.js#L42-L52
pickAndResize(elem)
#image_target
.image-show-container
NaN
undefined
selectFunction
03897624fe83e82908d5fcc36cf4e23c477ba43b
Describe the bug Upon page load, images with a dimension far smaller than the viewport is displayed using the 'large' version, instead of 'full'.
To Reproduce Steps to reproduce the behavior:
Expected behavior Expect only the 'full' version of the image to be used.
Desktop (please complete the following information):
Additional context The bug appears to be introduced in 49f0476
The function
pickAndResize(elem)
in image_expansion.js expects the element passed in (#image_target
) to have the the 'data-image-size' and 'data-mime-type' attributes: https://github.com/philomena-dev/philomena/blob/49f0476ad84b0dea91a7a9bea9db758f45a9af84/assets/js/image_expansion.js#L62-L63 However, the attributes were added to the parent element.image-show-container
instead, causing the valuesNaN
andundefined
to be assigned to the variables, leading to failing of the final check inselectFunction
: https://github.com/philomena-dev/philomena/blob/49f0476ad84b0dea91a7a9bea9db758f45a9af84/assets/js/image_expansion.js#L42-L52