[buddypress-trac] [BuddyPress] #4705: bp_core_avatar_handle_crop() needs to save extensions correctly

buddypress-trac noreply at wordpress.org
Wed Dec 5 13:07:17 UTC 2012


#4705: bp_core_avatar_handle_crop() needs to save extensions correctly
--------------------------+-----------------------------
 Reporter:  voldomazta    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 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;`

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4705>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list