Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#6634 closed defect (bug) (fixed)

Wrong Thumb size (Thumb == Full)

Reported by: damland Owned by: imath
Milestone: 2.3.4 Priority: highest
Severity: major Version: 2.3.0
Component: Media 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 4 years ago.
6634.patch (986 bytes) - added by imath 4 years ago.

Download all attachments as: .zip

Change History (9)

#1 @damland
4 years ago

  • Cc damturbo@… added

#2 @imath
4 years ago

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

#3 @imath
4 years ago

  • Milestone changed from Awaiting Review to 2.3.4
  • Owner set to imath
  • Status changed from new to assigned
  • Version changed from 2.3.3 to 2.3.0

I confirm. Let's fix this for 2.3.4

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

@imath
4 years ago

#4 @DJPaul
4 years ago

  • Keywords commit added

Looks good to me

#5 @imath
4 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
4 years ago

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

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
3 years ago

  • Component changed from Component - Attachments to Media
Note: See TracTickets for help on using tickets.