Changeset 8673
- Timestamp:
- 07/23/2014 02:43:05 PM (10 years ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-avatars.php
r8542 r8673 671 671 } 672 672 673 // If the uploaded image is smaller than the "full" dimensions, throw 674 // a warning 675 $uploaded_image = @getimagesize( bp_core_avatar_upload_path() . buddypress()->avatar_admin->image->dir ); 676 $full_width = bp_core_avatar_full_width(); 677 $full_height = bp_core_avatar_full_height(); 678 if ( isset( $uploaded_image[0] ) && $uploaded_image[0] < $full_width || $uploaded_image[1] < $full_height ) { 679 bp_core_add_message( sprintf( __( 'You have selected an image that is smaller than recommended. For best results, upload a picture larger than %d x %d pixels.', 'buddypress' ), $full_width, $full_height ), 'error' ); 680 } 681 673 682 // Set the url value for the image 674 683 $bp->avatar_admin->image->url = bp_core_avatar_url() . $bp->avatar_admin->image->dir; -
trunk/src/bp-core/bp-core-cssjs.php
r8647 r8673 84 84 85 85 // Default cropper coordinates 86 $crop_left = round( $image[0] / 4 ); 87 $crop_top = round( $image[1] / 4 ); 88 $crop_right = $image[0] - $crop_left; 89 $crop_bottom = $image[1] - $crop_top; ?> 86 87 // Smaller than full-width: cropper defaults to entire image 88 if ( $image[0] < $full_width ) { 89 $crop_left = 0; 90 $crop_right = $image[0]; 91 92 // Less than 2x full-width: cropper defaults to full-width 93 } else if ( $image[0] < ( $full_width * 2 ) ) { 94 $padding_w = round( ( $image[0] - $full_width ) / 2 ); 95 $crop_left = $padding_w; 96 $crop_right = $image[0] - $padding_w; 97 98 // Larger than 2x full-width: cropper defaults to 1/2 image width 99 } else { 100 $crop_left = round( $image[0] / 4 ); 101 $crop_right = $image[0] - $crop_left; 102 } 103 104 // Smaller than full-height: cropper defaults to entire image 105 if ( $image[1] < $full_height ) { 106 $crop_top = 0; 107 $crop_bottom = $image[1]; 108 109 // Less than double full-height: cropper defaults to full-height 110 } else if ( $image[1] < ( $full_height * 2 ) ) { 111 $padding_h = round( ( $image[1] - $full_height ) / 2 ); 112 $crop_top = $padding_h; 113 $crop_bottom = $image[1] - $padding_h; 114 115 // Larger than 2x full-height: cropper defaults to 1/2 image height 116 } else { 117 $crop_top = round( $image[1] / 4 ); 118 $crop_bottom = $image[1] - $crop_top; 119 } 120 121 ?> 90 122 91 123 <script type="text/javascript">
Note: See TracChangeset
for help on using the changeset viewer.