Opened 12 years ago
Closed 12 years ago
#4705 closed defect (bug) (fixed)
bp_core_avatar_handle_crop() needs to save extensions correctly
Reported by: | 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;
(In [6600]) Avatars: