WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#19539 closed defect (bug) (fixed)

get_avatar() returning wrong image size which inserts large image in admin bar

Reported by: andrewryno Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.3
Component: Toolbar Keywords: has-patch commit
Focuses: Cc:

Description

Just updated a site to 3.3 and noticed that when you open the "Howdy, {user}" admin bar menu, the image sometimes is larger than the 64px image requested by get_avatar() (/wp-includes/admin-bar.php line 174). It instead is showing a 156x156 image.

I don't know if this is a bug in get_avatar() or what. But get_avatar() DOES output the correct HTML with width and height set to 6 and the ?s=64 query string added to the URL. However, the reset for the admin bar (#wpadminbar *) sets width/height to auto, so those HTML attributes are ignored.

Wrote a patch to resize it using CSS, but I don't know if it's a bug in get_avatar() that might need to be addressed.

Attachments (2)

Screenshot 2011-12-13 at 16.png (26.7 KB) - added by andrewryno 2 years ago.
19539.diff (363 bytes) - added by andrewryno 2 years ago.

Download all attachments as: .zip

Change History (11)

andrewryno2 years ago

comment:1 ryno2672 years ago

  • Cc chuck@… added

+1

comment:2 boonebgorges2 years ago

  • Cc boonebgorges@… added

See also #BP3782. In the case of BuddyPress, we give users an easy way to serve up a local fallback (the ?d= parameter for the Gravatar call), and it's only in cases where the logged-in user falls back on this locally served avatar that the problem arises. I can confirm that 19539.diff will fix the problem.

Version 0, edited 2 years ago by boonebgorges (next)

comment:3 SergeyBiryukov2 years ago

  • Component changed from General to Toolbar
  • Milestone changed from Awaiting Review to 3.4

comment:5 trepmal2 years ago

+1

Just saw this bug in action (and submitted that dupe ticket with patch) while working on a plugin of mine (Add New Default Avatar).

comment:6 nacin2 years ago

  • Keywords commit added

Which patch, folks?

comment:7 follow-up: helenyhou2 years ago

Vote for 19539.diff. Already positioned with pixels, might as well expect it to be a certain size in the same selector and keep it together.

comment:8 in reply to: ↑ 7 boonebgorges2 years ago

Replying to helenyhou:

Vote for 19539.diff.

+1

comment:9 nacin2 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [20657]:

Explicitly set the dimensions of the avatar in the toolbar's profile menu. Avoids issues where overridden avatars could result in images that don't fit. props andrewryno. fixes #19539.

Note: See TracTickets for help on using tickets.