#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 );
}
Thanks for your feedback. I will look at it today.