craftcms / craftcms/cms

[5.x]: Assets image preview blows up

Open
#15,940 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

Preview of an image asset gets blown up when previewed.

Steps to reproduce
  1. When you click the preview button on the thumbnail, you get a larger version in some kind of popup.
  2. The popup takes the entire width of the screen. This is often larger than the image provided (max width of 1000px) for the preview.
Expected behavior

That the popup doesn't blow up the image. So that the popup will never be larger than the max size of the image.

Actual behavior

The popup is shown 100vw and the image scales with it. So the image is often shown larger than its maximum resolution. Resulting in a blown up image.

Craft CMS version

5.4.2

PHP version

8.2

Operating system and version

MacOS 15.0.1

Database type and version

mysql 8.0

Image driver and version

No response

Installed plugins and versions

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 from the image asset thumbnail's preview button and trace the popup and image sizing behavior in the frontend. Reproduce the issue with an image whose maximum width is 1000px, then verify that the preview no longer displays it larger than its available resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.