Skip to content

Aspect ratio not maintained on small screens for attachments with no thumbnail #7338

Closed
@Sesquipedalian

Description

@Sesquipedalian

Description

When image attachment thumbnails are quite large, the thumbnail's aspect ration may be distorted when the thumbnail is viewed on a small device. This is because the width and height attributes are set on the thumbnail, but then CSS sets max-width: 100% on it.

Steps to reproduce

  1. Enable attachment thumbnails and set the thumbnail size to something quite large, e.g. 1000 x 1000.
  2. Attach a large image to a post.
  3. View the post on a small device.

Environment (complete as necessary)

  • Version/Git revision:
  • Database Type:
  • Database Version:
  • PHP Version:

Additional information/references

To fix this, all we need to do is remove the height="' . $attachment['height'] . '" bit from this line:
https://github.com/SimpleMachines/SMF2.1/blob/b9e3b273aa8c1dcdde424dfb751e65bd223f2d4c/Themes/default/Display.template.php#L786

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions