nextcloud / nextcloud/viewer

Small images display at native tiny size in Viewer — no minimum scale applied

Open Beginner friendly
#3,196 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
119
Forks
72
Avg merge
18h 42m
Merged PRs (30d)
24

Description

Bug description

When a shared image fits entirely within Talk's preview constraints
(600 px wide × 384 px tall), it is shown at native 1:1 pixel size
both as a chat thumbnail and when opened in the Viewer.
For small images this makes the Viewer indistinguishable from the thumbnail:
clicking the image appears to do nothing useful.

The Viewer should always scale images to fill a readable portion of the
viewport, regardless of native dimensions.

Steps to reproduce

  1. Share two PNG images in a Talk room:
    • Image A: 840×91 px (wider than 600 px constraint)
    • Image B: 458×57 px (fits within 600×384 px — both dimensions smaller)
  2. Click Image A → opens visibly larger than the chat thumbnail ✓
  3. Click Image B → appears the same tiny size as the chat thumbnail ✗

Expected behavior

Both images open in the Viewer scaled to a readable size,
regardless of their native pixel dimensions.

Actual behavior

Image B (458×57 px) is displayed at 1:1 native pixels.
The Viewer popup looks identical in size to the inline chat thumbnail.

Both images return the same Talk API metadata:

{ "mimetype": "image/png", "preview-available": "yes" }

The only difference is width/height.

Root cause

FilePreview.vueimageContainerStyle:

const sizeMultiplicator = Math.min(
    (heightConstraint > height ? 1 : heightConstraint / height),
    (widthConstraint  > width  ? 1 : widthConstraint  / width)
)

When both dimensions are below the constraints (600×384 px),
sizeMultiplicator = Math.min(1, 1) = 1.
There is no lower bound — images are never scaled up.

Image A (840×91): width exceeds 600 px → sizeMultiplicator = 600/840 = 0.71
→ displayed at 600×65 px (noticeably larger than thumbnail) ✓

Image B (458×57): both dimensions fit → sizeMultiplicator = 1
→ displayed at 458×57 px (same as thumbnail) ✗

Environment

  • Nextcloud: 33.0.4
  • Nextcloud Talk: 23.0.5
  • Browsers: Chrome 148, Safari — Windows, macOS, web (all platforms)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in FilePreview.vue at imageContainerStyle and inspect how the 600×384 px constraints calculate the image scale. Reproduce with the 840×91 px and 458×57 px PNG examples, then verify that both open in the Viewer at a readable size rather than leaving the smaller image at native 1:1 dimensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.