Skip to:
Content

BuddyPress.org

Changeset 5666


Ignore:
Timestamp:
01/28/2012 06:24:25 PM (13 years ago)
Author:
djpaul
Message:

Improve error handling when trying to crop images. See #3958

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-avatars.php

    r5652 r5666  
    613613    $full_cropped  = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, bp_core_avatar_full_width(), bp_core_avatar_full_height(), false, $avatar_folder_dir . '/' . $full_filename );
    614614    $thumb_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, bp_core_avatar_thumb_width(), bp_core_avatar_thumb_height(), false, $avatar_folder_dir . '/' . $thumb_filename );
     615
     616    // Check for errors
     617    if ( ! $full_cropped || ! $thumb_cropped || is_wp_error( $full_cropped ) || is_wp_error( $thumb_cropped ) )
     618        return false;
    615619
    616620    // Remove the original
Note: See TracChangeset for help on using the changeset viewer.