Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/03/2010 11:28:51 PM (15 years ago)
Author:
apeatling
Message:

Fixes #2317 props jjj

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core/bp-core-avatars.php

    r2957 r2984  
    109109        $html_height = ( 'thumb' == $type ) ? ' height="' . BP_AVATAR_THUMB_HEIGHT . '"' : ' height="' . BP_AVATAR_FULL_HEIGHT . '"';
    110110
    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 );
    112112    $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
    113113
     
    294294    /* We only want to handle one image after resize. */
    295295    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'] );
    297297    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 );
    299299        @unlink( $bp->avatar_admin->original['file'] );
    300300    }
    301301
    302302    /* 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;
    304304
    305305    return true;
     
    334334        return false;
    335335
    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 ) )
    337339        return false;
    338340
    339341    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 );
    341343    else
    342344        $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
     
    363365
    364366    /* 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 );
    367369
    368370    /* Remove the original */
    369     @unlink( WP_CONTENT_DIR . $original_file );
     371    @unlink( $original_file );
    370372
    371373    return true;
     
    414416
    415417function 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'] );
    426420}
    427421
    428422function 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'] );
    433425}
    434426
Note: See TracChangeset for help on using the changeset viewer.