Skip to content

fix(image): auto-scale embedded images to fit their container#8800

Open
omnizs38 wants to merge 1 commit into
nextcloud:mainfrom
omnizs38:feature/auto-scale-embedded-images
Open

fix(image): auto-scale embedded images to fit their container#8800
omnizs38 wants to merge 1 commit into
nextcloud:mainfrom
omnizs38:feature/auto-scale-embedded-images

Conversation

@omnizs38

@omnizs38 omnizs38 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Embedded images were not reliably scaled to fit the available width, and tall images could overflow the surrounding frame instead of being shrunk to be fully visible.

Constrain the rendered image with max-width: 100% and object-fit: contain while letting width and height stay auto, so the whole image is always visible and the frame adjusts to the image's real aspect ratio without reserving fixed empty space.

📝 Summary

Specifically, it addresses the first two of the three points in that issue:

  1. Auto-scale embedded images so the whole image is visible images now get max-width: 100% + object-fit: contain with auto width/height.
  2. Auto-adjust the frame around the image — height: auto lets the frame collapse to the image's real aspect ratio instead of reserving fixed empty space.

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI tools
  • The AI-generated content was reviewed, comprehended and tested by a human

Embedded images were not reliably scaled to fit the available width,
and tall images could overflow the surrounding frame instead of being
shrunk to be fully visible.

Constrain the rendered image with max-width: 100% and object-fit:
contain while letting width and height stay auto, so the whole image
is always visible and the frame adjusts to the image's real aspect
ratio without reserving fixed empty space.

Signed-off-by: omnizs38 <omnizs@proton.me>
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.

1 participant