Changeset 20806 for trunk/wp-admin/custom-header.php
- Timestamp:
- 05/16/2012 05:47:55 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/custom-header.php
r20769 r20806 785 785 <input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" /> 786 786 <?php if ( empty( $_POST ) && isset( $_GET['file'] ) ) { ?> 787 <input type="hidden" name=" new-attachment" value="true" />787 <input type="hidden" name="create-new-attachment" value="true" /> 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> … … 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 ); 874 if ( empty( $_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 elseif ( ! empty( $_POST['create-new-attachment'] ) ) 877 $cropped = _copy_image_file( $attachment_id ); 878 else 879 $cropped = get_attached_file( $attachment_id ); 880 871 881 if ( ! $cropped || is_wp_error( $cropped ) ) 872 882 wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); 873 883 874 884 $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication 875 $is_cropped = ( get_attached_file( $attachment_id ) != $cropped );876 885 877 886 $parent = get_post($attachment_id); … … 891 900 'context' => 'custom-header' 892 901 ); 893 if ( ! empty( $_POST[' new-attachment'] ) )902 if ( ! empty( $_POST['create-new-attachment'] ) ) 894 903 unset( $object['ID'] ); 895 904 … … 914 923 if ( file_exists( $medium ) ) 915 924 @unlink( apply_filters( 'wp_delete_file', $medium ) ); 916 if ( empty( $_POST[' new-attachment'] ) && $is_cropped)925 if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) 917 926 @unlink( apply_filters( 'wp_delete_file', $original ) ); 918 927
Note: See TracChangeset
for help on using the changeset viewer.