Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Function theme_image() doesn't actually return a width and height for an image like it claims to do.
Comment | File | Size | Author |
---|---|---|---|
#8 | system.module_10.patch | 1.53 KB | m3avrck |
#3 | drupal_13.patch | 2.75 KB | m3avrck |
#2 | drupal_12.patch | 2.75 KB | m3avrck |
#1 | drupal_11.patch | 2.74 KB | m3avrck |
Comments
Comment #1
m3avrck CreditAttribution: m3avrck commentedOk patched attached, which fixes this issue. Also, included a patch for system.module which sets the screen shots to 'TRUE' so image dimensions will also be outputted there as well (which they should be!).
Comment #2
m3avrck CreditAttribution: m3avrck commentedFixed a tab issue.
Comment #3
m3avrck CreditAttribution: m3avrck commentedFixed a spacing issue.
Comment #4
Souvent22 CreditAttribution: Souvent22 commentedUsed the patch, and did a quick test. Worked well for me. +1.
Comment #5
Robrecht Jacques CreditAttribution: Robrecht Jacques commentedI don't see why this patch is needed, "theme_image" returns a img tag with the width and height set if $getsize = TRUE.
Eg:
will return:
(if druplicon.png is copied to the files/ directory).
I don't see what you are fixing...
You are right about the use of theme('image') in system.module though. The "false" should be "true".
Comment #6
m3avrck CreditAttribution: m3avrck commentedWell the actual code in theme_image() returned this:
There is *no* mention of the $width and $height variables that are assigned above, not used at all. I checked images in the themes directory and none had this information, unless I was missing something obvious, I see no way that is being generated... nothing in the above img src about it.
Comment #7
Dries CreditAttribution: Dries commentedTaken from http://php.net/getimagesize: "Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.".
$image_attributes
contains this information. Marking this fixed. Please reopen if not.Comment #8
m3avrck CreditAttribution: m3avrck commentedDries, great catch! What prompted this originally was that the screenshots on the theme page didn't have dimensions, didn't realize that index [3] returned this. Anyways, this patch fixes the screen shots and adds widths/heights.
Comment #9
Robrecht Jacques CreditAttribution: Robrecht Jacques commentedThis is correct, the theme('image') for the screenshots need to have TRUE as last parameter, or omit the parameter (like the patch does). This last patch is ok. Didn't test it, but I'm sure it is correct. Without the width and height is will work too (it has before), but this is cleaner HTML.
Patch is ready to commit.
Comment #10
Dries CreditAttribution: Dries commentedCommitted to HEAD. Thanks.
Comment #11
(not verified) CreditAttribution: commentedComment #12
(not verified) CreditAttribution: commentedComment #13
(not verified) CreditAttribution: commented