Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#19539 closed defect (bug) (fixed)

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

Reported by: andrewryno's profile andrewryno Owned by: nacin's profile 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 13 years ago.
19539.diff (363 bytes) - added by andrewryno 13 years ago.

Download all attachments as: .zip

Change History (11)

@andrewryno
13 years ago

#1 @ryno267
13 years ago

  • Cc chuck@… added

+1

#2 @boonebgorges
13 years ago

  • Cc boonebgorges@… added

See also https://buddypress.trac.wordpress.org/ticket/3782#comment:13. 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.

Last edited 13 years ago by boonebgorges (previous) (diff)

#3 @SergeyBiryukov
13 years ago

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

#5 @trepmal
13 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).

#6 @nacin
12 years ago

  • Keywords commit added

Which patch, folks?

#7 follow-up: @helenyhou
12 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.

#8 in reply to: ↑ 7 @boonebgorges
12 years ago

Replying to helenyhou:

Vote for 19539.diff.

+1

#9 @nacin
12 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.