Changeset 2729
- Timestamp:
- 02/16/2010 04:40:58 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-avatars.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-avatars.php
r2695 r2729 209 209 210 210 if ( $av_dir = opendir( $avatar_folder_dir ) ) { 211 while ( false !== ( $avatar_file = readdir($av_dir) ) ) {211 while ( false !== ( $avatar_file = readdir($av_dir) ) ) { 212 212 if ( ( preg_match( "/-bpfull/", $avatar_file ) || preg_match( "/-bpthumb/", $avatar_file ) ) && '.' != $avatar_file && '..' != $avatar_file ) 213 213 @unlink( $avatar_folder_dir . '/' . $avatar_file ); 214 214 } 215 215 } 216 closedir($av_dir);216 closedir($av_dir); 217 217 218 218 @rmdir( $avatar_folder_dir ); … … 230 230 231 231 $uploadErrors = array( 232 0 => __("There is no error, the file uploaded with success", 'buddypress'),233 1 => __("Your image was bigger than the maximum allowed file size of: ", 'buddypress') . size_format(BP_AVATAR_ORIGINAL_MAX_FILESIZE),234 2 => __("Your image was bigger than the maximum allowed file size of: ", 'buddypress') . size_format(BP_AVATAR_ORIGINAL_MAX_FILESIZE),235 3 => __("The uploaded file was only partially uploaded", 'buddypress'),236 4 => __("No file was uploaded", 'buddypress'),237 6 => __("Missing a temporary folder", 'buddypress')232 0 => __("There is no error, the file uploaded with success", 'buddypress'), 233 1 => __("Your image was bigger than the maximum allowed file size of: ", 'buddypress') . size_format(BP_AVATAR_ORIGINAL_MAX_FILESIZE), 234 2 => __("Your image was bigger than the maximum allowed file size of: ", 'buddypress') . size_format(BP_AVATAR_ORIGINAL_MAX_FILESIZE), 235 3 => __("The uploaded file was only partially uploaded", 'buddypress'), 236 4 => __("No file was uploaded", 'buddypress'), 237 6 => __("Missing a temporary folder", 'buddypress') 238 238 ); 239 239 … … 253 253 } 254 254 255 / / Filter the upload location255 /* Filter the upload location */ 256 256 add_filter( 'upload_dir', $upload_dir_filter, 10, 0 ); 257 257 258 258 $bp->avatar_admin->original = wp_handle_upload( $file['file'], array( 'action'=> 'bp_avatar_upload' ) ); 259 259 260 / / Move the file to the correct upload location.260 /* Move the file to the correct upload location. */ 261 261 if ( !empty( $bp->avatar_admin->original['error'] ) ) { 262 262 bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->original['error'] ), 'error' ); … … 264 264 } 265 265 266 / / Resize the image down to something manageable and then delete the original267 if ( getimagesize( $bp->avatar_admin->original['file'] ) > BP_AVATAR_ORIGINAL_MAX_WIDTH ) {266 /* Resize the image down to something manageable and then delete the original */ 267 if ( getimagesize( $bp->avatar_admin->original['file'] ) > BP_AVATAR_ORIGINAL_MAX_WIDTH ) 268 268 $bp->avatar_admin->resized = wp_create_thumbnail( $bp->avatar_admin->original['file'], BP_AVATAR_ORIGINAL_MAX_WIDTH ); 269 }270 269 271 270 $bp->avatar_admin->image = new stdClass; 272 271 273 / / We only want to handle one image after resize.272 /* We only want to handle one image after resize. */ 274 273 if ( empty( $bp->avatar_admin->resized ) ) 275 274 $bp->avatar_admin->image->dir = $bp->avatar_admin->original['file'];
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)