WordPress.org

Make WordPress Core

Ticket #23325: image.php.patch

File image.php.patch, 918 bytes (added by macbrink, 5 years ago)

patch for image.php including phpDocs

  • image.php

     
    2020 * @param int $dst_h The destination height.
    2121 * @param int $src_abs Optional. If the source crop points are absolute.
    2222 * @param string $dst_file Optional. The destination file to write to.
    23  * @return string|WP_Error|false New filepath on success, WP_Error or false on failure.
     23 * @return string|WP_Error New filepath on success, WP_Error on failure.
    2424 */
    2525function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
    2626        $src_file = $src;
     
    5454        $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
    5555
    5656        $result = $editor->save( $dst_file );
     57        if ( is_wp_error( $result ) )
     58                return $result;
     59               
    5760        return $dst_file;
    5861}
    5962