Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#6634 closed defect (bug) (fixed)

Wrong Thumb size (Thumb == Full)

Reported by: damland Owned by: imath
Priority: highest Milestone: 2.3.4
Component: Media Version: 2.3.0
Severity: major Keywords: has-patch commit
Cc: damturbo@…

Description

Since last ver. when the users upload their avatar the thumb has the same size of the full size image.

more info here:
https://buddypress.org/support/topic/why-bpthumb-bpfull/

Please fix it asap or websites will take forever to load thumbs, Thanks.
Bug fix is here:

/wp-content/plugins/buddypress/bp-core/classes/class-bp-attachment-avatar.php
added lines 263-268
the cropping function was using only the full avatar size for the thumb too

Get the file extension
$data = @getimagesize( $absolute_path );
$ext = $data[‘mime’] == ‘image/png’ ? ‘png’ : ‘jpg’;

$args[‘original_file’] = $absolute_path;
$args[‘src_abs’] = false;
$avatar_types = array( ‘full’ => ”, ‘thumb’ => ” );

foreach ( $avatar_types as $key_type => $type ) {
$args[‘dst_w’] = bp_core_avatar_full_width();
$args[‘dst_h’] = bp_core_avatar_full_height();
/*BUG FIX start*/
if($key_type==’thumb’){
$args[‘dst_w’] = bp_core_avatar_thumb_width();
$args[‘dst_h’] = bp_core_avatar_thumb_height();
}
/*BUG FIX end*/
$args[‘dst_file’] = $avatar_folder_dir . ‘/’ . wp_hash( $absolute_path . time() ) . ‘-bp’ . $key_type . ‘.’ . $ext;

$avatar_types[ $key_type ] = parent::crop( $args );
}

Attachments (2)

class-bp-attachment-avatar.php (11.6 KB ) - added by damland 11 years ago.
6634.patch (986 bytes ) - added by imath 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @damland
11 years ago

  • Cc damturbo@… added

#2 @imath
11 years ago

Thanks for your feedback. I will look at it today.

#3 @imath
11 years ago

  • Milestone Awaiting Review2.3.4
  • Owner set to imath
  • Status newassigned
  • Version 2.3.32.3.0

I confirm. Let's fix this for 2.3.4

If no objections, i will commit 6634.patch later today

@imath
11 years ago

#4 @DJPaul
11 years ago

  • Keywords commit added

Looks good to me

#5 @imath
11 years ago

In 10144:

Make sure the thumb size is used to crop the thumb avatar

2.3.0 introduced the BP_Attachment_Avatar class to manage avatar uploads. Unfortunately the full avatar size was mistakenly used to set full and thumb avatars.
This commit makes sure the right size will be used to set the avatars.

Props damland

See #6634 (branch 2.3)

#6 @imath
11 years ago

  • Resolutionfixed
  • Status assignedclosed

In 10145:

Make sure the thumb size is used to crop the thumb avatar

2.3.0 introduced the BP_Attachment_Avatar class to manage avatar uploads. Unfortunately the full avatar size was mistakenly used to set full and thumb avatars.
This commit makes sure the right size will be used to set the avatars.

Props damland

Fixes #6634 (trunk)

#7 @DJPaul
10 years ago

  • Component Component - AttachmentsMedia
Note: See TracTickets for help on using tickets.