diff --git src/bp-core/bp-core-avatars.php src/bp-core/bp-core-avatars.php
index f6a69205f..301c6bfdc 100644
|
|
function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) { |
981 | 981 | } |
982 | 982 | |
983 | 983 | // Maybe resize. |
| 984 | $original_file_size = $avatar_attachment->get_image_data( $bp->avatar_admin->original['file'] ); |
984 | 985 | $bp->avatar_admin->resized = $avatar_attachment->shrink( $bp->avatar_admin->original['file'], $ui_available_width ); |
985 | 986 | $bp->avatar_admin->image = new stdClass(); |
986 | 987 | |
… |
… |
function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) { |
1003 | 1004 | |
1004 | 1005 | // If the uploaded image is smaller than the "full" dimensions, throw a warning. |
1005 | 1006 | if ( $avatar_attachment->is_too_small( $bp->avatar_admin->image->file ) ) { |
1006 | | /* translators: 1: the advised width size in pixels. 2: the advised height size in pixels. */ |
1007 | | bp_core_add_message( sprintf( __( 'You have selected an image that is smaller than recommended. For best results, upload a picture larger than %1$d x %2$d pixels.', 'buddypress' ), bp_core_avatar_full_width(), bp_core_avatar_full_height() ), 'error' ); |
| 1007 | if ( isset( $original_file_size['width'] ) && $original_file_size['width'] > bp_core_avatar_full_width() ) { |
| 1008 | $aspect_ratio = number_format_i18n( bp_core_avatar_full_width() / bp_core_avatar_full_height(), 2 ); |
| 1009 | |
| 1010 | /* translators: %s: the value of the aspect ratio. */ |
| 1011 | bp_core_add_message( sprintf( __( 'The aspect ratio of the image you selected is too great compared to the profile photo one. For best results, upload a picture having an aspect ratio closer to %s.', 'buddypress' ), $aspect_ratio ), 'error' ); |
| 1012 | } else { |
| 1013 | |
| 1014 | /* translators: 1: the advised width size in pixels. 2: the advised height size in pixels. */ |
| 1015 | bp_core_add_message( sprintf( __( 'You have selected an image that is smaller than recommended. For best results, upload a picture larger than %1$d x %2$d pixels.', 'buddypress' ), bp_core_avatar_full_width(), bp_core_avatar_full_height() ), 'error' ); |
| 1016 | } |
1008 | 1017 | } |
1009 | 1018 | |
1010 | 1019 | // Set the url value for the image. |
diff --git src/bp-core/js/bp-plupload.js src/bp-core/js/bp-plupload.js
index d73bd8931..3416de196 100644
|
|
window.bp = window.bp || {}; |
80 | 80 | * checked during the upload process to eventually adapt the resized avatar. |
81 | 81 | */ |
82 | 82 | if ( 'bp_avatar_upload' === uploader.settings.multipart_params.action ) { |
83 | | uploader.settings.multipart_params.bp_params.ui_available_width = container.width(); |
| 83 | uploader.settings.multipart_params.bp_params.ui_available_width = container.width(); |
84 | 84 | } |
85 | 85 | |
86 | 86 | if ( uploader.features.dragdrop && ! self.params.browser.mobile ) { |