Skip to:
Content

BuddyPress.org

Changeset 2984


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

Fixes #2317 props jjj

Location:
branches/1.2
Files:
5 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
  • branches/1.2/bp-core/bp-core-cssjs.php

    r2938 r2984  
    7979    global $bp;
    8080
    81     $image = apply_filters( 'bp_inline_cropper_image', getimagesize( $bp->avatar_admin->image->dir ) );
     81    $image = apply_filters( 'bp_inline_cropper_image', getimagesize( BP_AVATAR_UPLOAD_PATH . $bp->avatar_admin->image->dir ) );
    8282    $aspect_ratio = 1;
    8383
  • branches/1.2/bp-core/bp-core-signup.php

    r2934 r2984  
    520520        @wp_mkdir_p( $path );
    521521
    522     $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );
     522    $newurl = BP_AVATAR_URL . '/avatars/signups/' . $bp->signup->avatar_dir;
    523523    $newburl = $newurl;
    524524    $newsubdir = '/avatars/signups/' . $bp->signup->avatar_dir;
  • branches/1.2/bp-groups.php

    r2973 r2984  
    18601860        @wp_mkdir_p( $path );
    18611861
    1862     $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );
     1862    $newurl = BP_AVATAR_URL . '/group-avatars/' . $group_id;
    18631863    $newburl = $newurl;
    18641864    $newsubdir = '/group-avatars/' . $group_id;
  • branches/1.2/bp-xprofile.php

    r2982 r2984  
    876876        @wp_mkdir_p( $path );
    877877
    878     $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );
     878    $newurl  = BP_AVATAR_URL . '/avatars/' . $user_id;
    879879    $newburl = $newurl;
    880880    $newsubdir = '/avatars/' . $user_id;
Note: See TracChangeset for help on using the changeset viewer.