Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration option to keep the zoomed image from growing to larger than its largest size #216

Open
gingersoulrecords opened this issue May 25, 2024 · 1 comment

Comments

@gingersoulrecords
Copy link

The problem

When I apply medium-zoom to all images in my (blogging) application, some images are smaller than the viewport at their largest size, but get zoomed to fit the viewport, which causes them to be blurred.

Solution

I would like a config option to 'cap' the image scale to the native width/height of the image (per its width/height attributes), keeping it vertically and horizontally centered above the overlay. If it's larger than the viewport, fill the viewport, but don't zoom it past its 'largest' size.

Implementation

Include the image’s width/height attributes in the scale math so that it scales up to its largest native size if it's smaller than the current viewport.

@gingersoulrecords
Copy link
Author

Reference: the 'small image' example here: https://photoswipe.com/adjusting-zoom-level/#image-is-smaller-than-initial-and-secondary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant