Skip to:

Opened 14 years ago

Closed 14 years ago

#2206 closed defect (bug) (fixed)

strange avatars break uploads

Reported by: luccame's profile luccame Owned by:
Milestone: 1.2.4 Priority: major
Severity: Version:
Component: Core Keywords: avatar upload


if you try to upload an avatar 1px width * 451px height it fails and go on a blank screen without warning or errors.

1px width * <451px height : works

1px width * 451px height : works

1px width * >=451px height : fails

DJPaul said: in your bug report mention BP_AVATAR_ORIGINAL_MAX_WIDTH in bp-core-avatars.php

Change History (5)

#1 @ipstenu
14 years ago

From Phlux0r

Looks like in BuddyPress 1.2.3 the avatar size check is not compatible with the WordPress thumbnailing function.

If you look in bp-code/bp-core-avatars.php, function: bp_core_avatar_handle_upload()

there is a getimagesize() call. That actually returns an array, not a single value so the if statement will not evaluate correctly and the code will always attempt to create a thumbnail. If that fails, the wp_create_thumbnail() function returns a WP_Error object, hence the message some are getting.

here’s my modded code to fix this issue:

/* Resize the image down to something manageable and then delete the original */
/* HACK made some changes to check image parameters more carefully */
$_size = getimagesize( $bp->avatar_admin->original['file'] );
if ( $_size[0] > BP_AVATAR_ORIGINAL_MAX_WIDTH ) {
$_thumb = wp_create_thumbnail( $bp->avatar_admin->original['file'], BP_AVATAR_ORIGINAL_MAX_WIDTH );
// Need to check if upload succeeded - issue with small files!
if ( is_object($_thumb) && get_class($_thumb) == 'WP_Error' ) {
bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $_thumb->get_error_message()), 'error');
return false;
$bp->avatar_admin->resized = $_thumb;


#2 @ipstenu
14 years ago

  • Priority changed from trivial to major

Classifying this as major since a LOT of people are going to kvetch if they can't upload avatars :)

#3 @DJPaul
14 years ago

  • Milestone set to 1.2.4

#5 @johnjamesjacoby
14 years ago

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

(In [2957]) Fixes #2206 props ipstenu

Note: See TracTickets for help on using tickets.