Ticket #11895: image-edit.patch
File image-edit.patch, 4.5 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/image-edit.php
173 173 <strong><?php _e('Apply changes to:'); ?></strong><br /> 174 174 175 175 <label class="imgedit-label"> 176 <input type=" radio" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" />177 <?php _e(' All image sizes'); ?></label>176 <input type="checkbox" name="imgedit-target-<?php echo $post_id; ?>" value="thumbnail" checked="checked" /> 177 <?php _e('Thumbnail'); ?></label> 178 178 179 179 <label class="imgedit-label"> 180 <input type=" radio" name="imgedit-target-<?php echo $post_id; ?>" value="thumbnail" />181 <?php _e(' Thumbnail'); ?></label>180 <input type="checkbox" name="imgedit-target-<?php echo $post_id; ?>" value="medium" checked="checked" /> 181 <?php _e('Medium'); ?></label> 182 182 183 183 <label class="imgedit-label"> 184 <input type="radio" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" /> 185 <?php _e('All sizes except thumbnail'); ?></label> 184 <input type="checkbox" name="imgedit-target-<?php echo $post_id; ?>" value="large" checked="checked" /> 185 <?php _e('Large'); ?></label> 186 187 <label class="imgedit-label"> 188 <input type="checkbox" name="imgedit-target-<?php echo $post_id; ?>" value="full" checked="checked" /> 189 <?php _e('Full size'); ?></label> 186 190 </p> 187 191 </div> 188 192 … … 505 509 506 510 $fwidth = !empty($_REQUEST['fwidth']) ? intval($_REQUEST['fwidth']) : 0; 507 511 $fheight = !empty($_REQUEST['fheight']) ? intval($_REQUEST['fheight']) : 0; 508 $target = !empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : '';512 $target = !empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : array(); 509 513 $scale = !empty($_REQUEST['do']) && 'scale' == $_REQUEST['do']; 510 514 511 515 if ( $scale && $fwidth > 0 && $fheight > 0 ) { … … 557 561 if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE && 558 562 isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) { 559 563 560 if ( 'thumbnail' == $target)564 if ( in_array('thumbnail', $target) ) 561 565 $new_path = "{$path_parts['dirname']}/{$filename}-temp.{$path_parts['extension']}"; 562 566 else 563 567 $new_path = $path; … … 580 584 return $return; 581 585 } 582 586 583 if ( 'nothumb' == $target || 'all' == $target || 'full' == $target|| $scaled ) {587 if ( in_array('full', $target) || $scaled ) { 584 588 $tag = false; 585 589 if ( isset($backup_sizes['full-orig']) ) { 586 590 if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) … … 601 605 list ( $uwidth, $uheight ) = wp_shrink_dimensions($meta['width'], $meta['height']); 602 606 $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; 603 607 604 if ( $success && ('nothumb' == $target || 'all' == $target) ) { 605 $sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') ); 606 if ( 'nothumb' == $target ) 607 $sizes = array_diff( $sizes, array('thumbnail') ); 608 if ( $success ) { 609 $sizes = $target; 608 610 } 609 611 610 612 $return->fw = $meta['width']; 611 613 $return->fh = $meta['height']; 612 } else if ( 'thumbnail' == $target ){613 $sizes = array( 'thumbnail' );614 } else { 615 $sizes = $target; 614 616 $success = $delete = $nocrop = true; 615 617 } 616 618 … … 643 645 wp_update_attachment_metadata($post_id, $meta); 644 646 update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes); 645 647 646 if ( $target == 'thumbnail' || $target == 'all' || $target == 'full') {648 if ( in_array('thumbnail', $target) || sizeof($target) == 4 || in_array('full', $target) ) { 647 649 $file_url = wp_get_attachment_url($post_id); 648 650 if ( $thumb = $meta['sizes']['thumbnail'] ) 649 651 $return->thumbnail = path_join( dirname($file_url), $thumb['file'] ); -
wp-admin/js/image-edit.dev.js
64 64 }, 65 65 66 66 getTarget : function(postid) { 67 return $('input[name=imgedit-target-' + postid + ']:checked', '#imgedit-save-target-' + postid).val() || 'full'; 67 var target = new Array(); 68 $('input[name=imgedit-target-' + postid + ']:checked').each(function() { 69 target.push(jQuery(this).val()); 70 }); 71 return target; 68 72 }, 69 73 70 74 scaleChanged : function(postid, x) { … … 241 245 '_ajax_nonce': nonce, 242 246 'postid': postid, 243 247 'history': history, 244 'target ': target,248 'target[]': target, 245 249 'do': 'save' 246 250 }; 247 251