Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 14 years ago

#4705 closed defect (bug) (fixed)

bp_core_avatar_handle_crop() needs to save extensions correctly

Reported by: voldomazta Owned by:
Priority: normal Milestone: 1.7
Component: Core Version:
Severity: normal 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
14 years ago

  • Milestone Awaiting Review1.7

#2 @johnjamesjacoby
14 years ago

  • Resolutionfixed
  • Status newclosed

(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.