It looks like the function image_display calls theme('image', ...) with attributes as a string, but the function theme_image expects attributes to be in array format which gives errors (warnings),
warning: Invalid argument supplied for foreach()

(I am not really sure if my testinstallation is using latest version of everything so if noone else has this problem this is probably because I havent updated them, will try to update in a day or to and recheck this.)

CommentFileSizeAuthor
#8 image-cvs-22533.patch808 bytesRobrecht Jacques
#2 image_4.patch994 bytespz

Comments

pz’s picture

Priority: Minor » Normal

Upgraded to priority normal.

There seems to be something wrong with drupals upload function now so I can't upload patch, so here is a manual fix
$attr = array('width' => $info['width'], 'height' => $info['height']) + $attributes;
should replace line 346 which was previously
$attr = 'width="'.$info['width'].'" height="'.$info['height'].'" ' . drupal_attributes($attributes);

pz’s picture

StatusFileSize
new994 bytes

Patch

pz’s picture

theme_image has now changed back, so this patch should not be applied.

pz’s picture

Version: 4.6.x-1.x-dev »

Should probably be applied against cvs but not 4.6

pz’s picture

walkah’s picture

is this still an issue? doesn't look like it to me...

closing.

pz’s picture

If I read the files correctly, the cvs version the function theme_image in file includes/theme.inc has changed and now wants an array instead of a string. For the 4.6.0 branch it wants a string and this patch should not be applied.

I am setting this to patch again for cvs, feel free to close it again if I have misunderstood anything.

Robrecht Jacques’s picture

StatusFileSize
new808 bytes

I can confirm this is still an issue in CVS:

  • clean install of drupal and image
  • add an image
  • the source says: <span class="image preview"><img src="http://localhost/~robrechtj/drupal-cvs/files/images/06_13_0.jpg" alt="a test image" title="a test image" /></span>
  • notice that no width or height attribute is set!
  • patching it (updated patch attached), gives: <span class="image preview"><img src="http://localhost/~robrechtj/drupal-cvs/files/images/06_13_0.jpg" alt="a test image" title="a test image" width="640" height="480"/></span>
  • note that the width and height are present

The reason is that in CVS "theme_image' now runs a 'drupal_attributes' on the 'attr' parameter. This parameter has changed from a string to an array in revision 1.235 of "theme.inc".

So, this patch NEEDS to be applied to CVS. And it SHOULD NOT be applied to 4-6.

Robrecht Jacques’s picture

Assigned: Unassigned » Robrecht Jacques
Status: Needs review » Reviewed & tested by the community

Patch ready to be committed.

One more thing: drupal_attributes returns an empty string if $attr is not an array, that is why the width and height "disappear".

walkah’s picture

Status: Reviewed & tested by the community » Fixed

committed, thanks!

Anonymous’s picture

Tobias Maier’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)