Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 11 years ago

#4705 closed defect (bug) (fixed)

bp_core_avatar_handle_crop() needs to save extensions correctly

Reported by: voldomazta's profile voldomazta Owned by:
Milestone: 1.7 Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

this is how this function sets the thumb filenames:

$full_filename = wp_hash( $original_file . time() ) . '-bpfull.jpg';
$thumb_filename = wp_hash( $original_file . time() ) . '-bpthumb.jpg';

it should instead check whether the filename was a png or a gif using the getimagesize() php func so that it can choose a correct extension for the filename instead of just jpg all the time:

$data = @getimagesize($original_file);
$ext = $data['mime'] == 'image/png' ? 'png' : 'jpg';

// Set the full and thumb filenames
$full_filename = wp_hash( $original_file . time() ) . '-bpfull.' . $ext;
$thumb_filename = wp_hash( $original_file . time() ) . '-bpthumb.' . $ext;

Change History (2)

#1 @johnjamesjacoby
11 years ago

  • Milestone changed from Awaiting Review to 1.7

#2 @johnjamesjacoby
11 years ago

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

(In [6600]) Avatars:

  • Clean up avatar code.
  • When uploading a png, use the correct file extension.
  • Fixes #4705.
  • Enqueue Jcrop styling.
Note: See TracTickets for help on using tickets.