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

Prevent thumbnail overflow in file info #1091

Merged
merged 3 commits into from
Mar 3, 2025
Merged

Conversation

lehecht
Copy link
Contributor

@lehecht lehecht commented Feb 26, 2025

Closes #1016.

@lehecht
Copy link
Contributor Author

lehecht commented Feb 26, 2025

I had to add the width and height properties because object-fit: contain wouldn’t work otherwise. However, this caused portrait thumbnails to enlarge, so I need to check whether a thumbnail is a portrait or landscape image.

@lehecht lehecht requested a review from mzur February 26, 2025 08:00
@mzur
Copy link
Member

mzur commented Feb 26, 2025

I assume this is no longer a draft?

@lehecht lehecht marked this pull request as ready for review February 27, 2025 06:35
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a single max-width: 100% would work here, too? Then there is no need for object-fit, height or the @if.

@lehecht
Copy link
Contributor Author

lehecht commented Feb 28, 2025

@mzur
Indeed, object-fit is not needed for landscape thumbnails, but portrait thumbnails are still displayed enlarged when using max-width: 100%.

Left: before change
Right: after change

|

@mzur
Copy link
Member

mzur commented Feb 28, 2025

Maybe add a max-height with a fixed pixel value then? I'd just like to avoid the @if check in the template, as this is basically just a CSS issue.

@lehecht
Copy link
Contributor Author

lehecht commented Feb 28, 2025

Sorry, I overlooked that I was still using width instead of max-width, so my previous comment is wrong. Using only width would have worked for landscape thumbnails only, but using object-fit with max-width: 100% and max-height: 100% works for all thumbnails without Blade directives.

@lehecht lehecht requested a review from mzur February 28, 2025 08:30
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the object-fit required at all now? Also I think a max-height: 100% has no effect. Better would be a max-height: 270px (as this is the default thumbnail size).

@lehecht
Copy link
Contributor Author

lehecht commented Mar 3, 2025

Is the object-fit required at all now? Also I think a max-height: 100% has no effect. Better would be a max-height: 270px (as this is the default thumbnail size).

I removed object-fit and max-height since they are unnecessary for preventing the thumbnail from overflowing the container.

@lehecht lehecht requested a review from mzur March 3, 2025 06:39
@mzur mzur merged commit b370e2d into master Mar 3, 2025
6 checks passed
@mzur mzur deleted the fix-img-thumbail-container branch March 3, 2025 10:50
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

Successfully merging this pull request may close these issues.

Fix thumbnail display in image/video info view
2 participants