Ticket #5089: 5089.patch
| File 5089.patch, 1.2 KB (added by , 13 years ago) |
|---|
-
bp-core-avatars.php
486 486 */ 487 487 function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) { 488 488 489 //read raw image data 490 $exif = @exif_read_data( $_FILES['file']['tmp_name'] ); 491 489 492 /*** 490 493 * You may want to hook into this filter if you want to override this function. 491 494 * Make sure you return false. … … 545 548 $editor = wp_get_image_editor( $bp->avatar_admin->original['file'] ); 546 549 547 550 if ( ! is_wp_error( $editor ) ) { 551 548 552 $editor->set_quality( 100 ); 549 553 554 if ( wp_is_mobile() ) { 555 //rotate images to display correct orientation from iOS 556 if( !empty( $exif['Orientation'] ) ) { 557 switch( $exif['Orientation'] ) { 558 case 8: 559 $editor->rotate( 90 ); 560 break; 561 case 3: 562 $editor->rotate( 180 ); 563 break; 564 case 6: 565 $editor->rotate( -90 ); 566 break; 567 } 568 } 569 } 570 550 571 $resized = $editor->resize( bp_core_avatar_original_max_width(), bp_core_avatar_original_max_width(), false ); 551 572 if ( ! is_wp_error( $resized ) ) { 552 573 $thumb = $editor->save( $editor->generate_filename() );