Dimensions of original image are used in generated HTML-code for thumbnails

Created on 6 September 2016, almost 9 years ago
Updated 11 June 2025, 3 months ago

Calling file_view_file($file, $view_mode) with a custom thumbnail-size will create HTML-code containing an IMG-tag which combines the URL for the thumbnail with width and height attributes appropriate for the original image.

This was noticed when, after an upgrade of Drupal core and modules, thumbnail-images inserted through a WYSIWYG-editor were not displayed with the correct dimensions. But manually calling 'file_view_file' from PHP-code yielded the same (erroneous) HTML-code.

Pre-upgrade, the same 'file_view_file'-call generated HTML-code which lacked the width- and height-attributes on the IMG-tag and hence worked correctly. There were no other differences in the generated HTML-code.

Post-upgrade module-versions:
Media: 7.x-2.0-beta2 (datestamp: 1464653492).
File_entity: 7.x-2.0-beta3 (datestamp 1464653173)
Styles: 7.x-2.0-alpha8+5-dev (datestamp 1380638144)

πŸ› Bug report
Status

Closed: outdated

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands Marco Vervoort

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    Thank you for your contributions to this issue. As Drupal 7 has reached its End of Life and is no longer supported, we are closing this issue. We encourage you to upgrade to a supported version of Drupal.

Production build 0.71.5 2024