Ticket #20657: 20657.6.patch
File 20657.6.patch, 2.0 KB (added by , 12 years ago) |
---|
-
wp-admin/custom-header.php
788 788 <?php } ?> 789 789 <?php wp_nonce_field( 'custom-header-crop-image' ) ?> 790 790 791 <?php submit_button( __( 'Crop and Publish' ) ); ?> 791 <p class="submit"><?php 792 submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); 793 if ( isset( $oitar ) && 1 == $oitar ) 794 submit_button( __( 'Skip Cropping, Use Image as Is' ), 'primary', 'skip-cropping', false ); 795 ?> 792 796 </p> 793 797 </form> 794 798 </div> … … 867 871 else 868 872 $dst_width = get_theme_support( 'custom-header', 'width' ); 869 873 870 $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $dst_width, $dst_height ); 871 if ( ! $cropped || is_wp_error( $cropped ) ) 872 wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); 874 if ( !isset( $_POST['skip-cropping'] ) ) { 875 $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $dst_width, $dst_height ); 876 if ( ! $cropped || is_wp_error( $cropped ) ) 877 wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); 878 } else { 879 $cropped = get_attached_file( $attachment_id ); 880 } 873 881 874 882 $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication 875 $is_cropped = ( get_attached_file( $attachment_id ) != $cropped);883 $is_cropped = ( !isset( $_POST['skip-cropping'] ) && ( get_attached_file( $attachment_id ) != $cropped ) ); 876 884 877 885 $parent = get_post($attachment_id); 878 886 $parent_url = $parent->guid; … … 890 898 'guid' => $url, 891 899 'context' => 'custom-header' 892 900 ); 893 if ( ! empty( $_POST['new-attachment'] ) )901 if ( ! empty( $_POST['new-attachment'] ) && $is_cropped ) 894 902 unset( $object['ID'] ); 895 903 896 904 // Update the attachment