WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/23/2009 06:39:31 PM (12 years ago)
Author:
ryan
Message:

Retunr WP_Error from wp_crop_image() and image_resize(). Props mdwaffe. fixes #9922

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/image.php

    r12351 r12524  
    3939 * @param int $src_abs Optional. If the source crop points are absolute.
    4040 * @param string $dst_file Optional. The destination file to write to.
    41  * @return string New filepath on success, String error message on failure.
     41 * @return string|WP_Error|false New filepath on success, WP_Error or false on failure.
    4242 */
    4343function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
     
    4747    $src = wp_load_image( $src_file );
    4848
    49     if ( !is_resource( $src ))
    50         return $src;
     49    if ( !is_resource( $src ) )
     50        return new WP_Error( 'error_loading_image', $src, $src_file );
    5151
    5252    $dst = wp_imagecreatetruecolor( $dst_w, $dst_h );
Note: See TracChangeset for help on using the changeset viewer.