Changeset 2984 for branches/1.2/bp-core/bp-core-avatars.php
- Timestamp:
- 05/03/2010 11:28:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-core/bp-core-avatars.php
r2957 r2984 109 109 $html_height = ( 'thumb' == $type ) ? ' height="' . BP_AVATAR_THUMB_HEIGHT . '"' : ' height="' . BP_AVATAR_FULL_HEIGHT . '"'; 110 110 111 $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH ). '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );111 $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', BP_AVATAR_URL . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir ); 112 112 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir ); 113 113 … … 294 294 /* We only want to handle one image after resize. */ 295 295 if ( empty( $bp->avatar_admin->resized ) ) 296 $bp->avatar_admin->image->dir = $bp->avatar_admin->original['file'];296 $bp->avatar_admin->image->dir = str_replace( BP_AVATAR_UPLOAD_PATH, '', $bp->avatar_admin->original['file'] ); 297 297 else { 298 $bp->avatar_admin->image->dir = $bp->avatar_admin->resized;298 $bp->avatar_admin->image->dir = str_replace( BP_AVATAR_UPLOAD_PATH, '', $bp->avatar_admin->resized ); 299 299 @unlink( $bp->avatar_admin->original['file'] ); 300 300 } 301 301 302 302 /* Set the url value for the image */ 303 $bp->avatar_admin->image->url = str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, $bp->avatar_admin->image->dir );303 $bp->avatar_admin->image->url = BP_AVATAR_URL . $bp->avatar_admin->image->dir; 304 304 305 305 return true; … … 334 334 return false; 335 335 336 if ( !file_exists( WP_CONTENT_DIR . '/' . $original_file ) ) 336 $original_file = BP_AVATAR_UPLOAD_PATH . $original_file; 337 338 if ( !file_exists( $original_file ) ) 337 339 return false; 338 340 339 341 if ( !$item_id ) 340 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', WP_CONTENT_DIR .dirname( $original_file ), $item_id, $object, $avatar_dir );342 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', dirname( $original_file ), $item_id, $object, $avatar_dir ); 341 343 else 342 344 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir ); … … 363 365 364 366 /* Crop the image */ 365 $full_cropped = wp_crop_image( WP_CONTENT_DIR .$original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename );366 $thumb_cropped = wp_crop_image( WP_CONTENT_DIR .$original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename );367 $full_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename ); 368 $thumb_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename ); 367 369 368 370 /* Remove the original */ 369 @unlink( WP_CONTENT_DIR .$original_file );371 @unlink( $original_file ); 370 372 371 373 return true; … … 414 416 415 417 function bp_core_avatar_upload_path() { 416 if ( bp_core_is_multisite() ) 417 $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, 'upload_path' ); 418 else { 419 if ( !$path = get_option( 'upload_path' ) ) 420 $path = WP_CONTENT_DIR . '/uploads'; 421 else 422 $path = ABSPATH . $path; 423 } 424 425 return apply_filters( 'bp_core_avatar_upload_path', $path ); 418 $upload_dir = wp_upload_dir(); 419 return apply_filters( 'bp_core_avatar_upload_path', $upload_dir['basedir'] ); 426 420 } 427 421 428 422 function bp_core_avatar_url() { 429 if ( !bp_core_is_multisite() ) 430 return WP_CONTENT_URL; 431 432 return apply_filters( 'bp_core_avatar_url', get_blog_option( BP_ROOT_BLOG, 'siteurl' ) ); 423 $upload_dir = wp_upload_dir(); 424 return apply_filters( 'bp_core_avatar_url', $upload_dir['baseurl'] ); 433 425 } 434 426
Note: See TracChangeset
for help on using the changeset viewer.