Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Lines 260 to 293: */
- /* Move the file to the correct upload location. */
- if ( !empty( $bp->avatar_admin->original['error'] ) ) {
- bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->original['error'] ), 'error' );
- return false;
- }
- /* Resize the image down to something manageable and then delete the original */
- /* HACK made some changes to check image parameters more carefully */
- $_size = getimagesize( $bp->avatar_admin->original['file'] );
- if ( $_size[0] > BP_AVATAR_ORIGINAL_MAX_WIDTH ) {
- $_thumb = wp_create_thumbnail( $bp->avatar_admin->original['file'], BP_AVATAR_ORIGINAL_MAX_WIDTH );
- // Need to check if upload succeeded - issue with small files!
- if ( is_object($_thumb) && get_class($_thumb) == 'WP_Error' ) {
- bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $_thumb->get_error_message()), 'error');
- return false;
- }
- $bp->avatar_admin->resized = $_thumb;
- }
- $bp->avatar_admin->image = new stdClass;
- /* We only want to handle one image after resize. */
- if ( empty( $bp->avatar_admin->resized ) )
- $bp->avatar_admin->image->dir = $bp->avatar_admin->original['file'];
- else {
- $bp->avatar_admin->image->dir = $bp->avatar_admin->resized;
- @unlink( $bp->avatar_admin->original['file'] );
- }
- /* Set the url value for the image */
- $bp->avatar_admin->image->url = str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, $bp->avatar_admin->image->dir );
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement