Make WordPress Core

Ticket #20657: 20657.2.patch

File 20657.2.patch, 1.1 KB (added by SergeyBiryukov, 12 years ago)
  • wp-admin/custom-header.php

     
    872872                        wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
    873873
    874874                $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication
     875                $is_cropped = ( get_attached_file( $attachment_id ) != $cropped );
    875876
    876877                $parent = get_post($attachment_id);
    877878                $parent_url = $parent->guid;
     
    909910                set_theme_mod( 'header_image_data', $header_data );
    910911
    911912                // cleanup
    912                 $medium = str_replace(basename($original), 'midsize-'.basename($original), $original);
     913                $medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original );
    913914                if ( file_exists( $medium ) )
    914915                        @unlink( apply_filters( 'wp_delete_file', $medium ) );
    915                 if ( empty ( $_POST['new-attachment'] ) )
     916                if ( empty( $_POST['new-attachment'] ) && $is_cropped )
    916917                        @unlink( apply_filters( 'wp_delete_file', $original ) );
    917918
    918919                return $this->finished();