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

[Feature Request] Resize webms/pictures/gifs exceeding user's window/certain resolution to fit constant size #3456

Closed
kakhulu31 opened this issue Apr 5, 2024 · 5 comments
Labels
cssfix For when the issue can be fixed with a CSS change instead of a whole new setting

Comments

@kakhulu31
Copy link

kakhulu31 commented Apr 5, 2024

Webm/picture/gif containers often have resolutions that, on click/hover, expand to widths exceeding the user's entire viewport, making it impossible to watch without adjusting the zoom, opening in a new tab, or using a gallery. It would be beneficial to enforce some size constraints.
For instance, with constraints set at a width of 1280 and a height of 720, the desired behavior would be:
for a 1920x1200 video, resize the webm window to the smallest constraint (height, 720 in this case), then resize the other dimension (width) to preserve the aspect ratio (1920*720/1200). The resulting window size would be 1152x720.

I guess this is probably achievable with a simple user css script but I don't know it unfortunately.

@kakhulu31 kakhulu31 changed the title [Feature Request] Resize webms exceeding user's window/certain resolution to fit constant size [Feature Request] Resize webms/pictures/gifs exceeding user's window/certain resolution to fit constant size Apr 5, 2024
@kakhulu31
Copy link
Author

So far I'm using this css that seems to work fine, but it doesn't work for previews

.fileThumb video, .fileThumb img.full-image {
  max-height: 720px;
  max-width: 1280px;
  object-fit: contain;
}

@saxamaphone69
Copy link
Collaborator

Sounds like you found your solution.

When you say "previews", do you mean when hovering over the thumbnail, the thumbnail itself, or hovering over a quotelink?
'Image on hover' should be #ihover, but I was under the impression that already shrinks to fit the browser.

There is also the aspect-ratio property that might help with what you're after. You can also use units like vw and vh which are based on the browser viewport width/height.

@saxamaphone69 saxamaphone69 added the cssfix For when the issue can be fixed with a CSS change instead of a whole new setting label Apr 5, 2024
@kakhulu31
Copy link
Author

kakhulu31 commented Apr 5, 2024

Thanks for the info, gpt will find it useful I guess. I would be able to solve the issue by using it but unfortunately 4chanx is too large so gpt doesn't know how previews are implemented.

When you say "previews", do you mean when hovering over the thumbnail, the thumbnail itself, or hovering over a quotelink?

I'm talking about hovering over the thumbnail:

1712356827786839.mp4

@saxamaphone69
Copy link
Collaborator

#ihover {
  max-height: 20px !important;
  max-width: 20px !important;
}

Should do it?

@kakhulu31
Copy link
Author

Yes it worked, thanks. I tried it myself but forgot about !important

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cssfix For when the issue can be fixed with a CSS change instead of a whole new setting
Projects
None yet
Development

No branches or pull requests

2 participants