Changeset 29206 for trunk/src/wp-admin/includes/image-edit.php
- Timestamp:
- 07/17/2014 09:13:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/image-edit.php
r28366 r29206 412 412 return $image; 413 413 414 // expand change operations414 // Expand change operations. 415 415 foreach ( $changes as $key => $obj ) { 416 416 if ( isset($obj->r) ) { … … 430 430 } 431 431 432 // combine operations432 // Combine operations. 433 433 if ( count($changes) > 1 ) { 434 434 $filtered = array($changes[0]); … … 454 454 } 455 455 456 // image resource before applying the changes456 // Image resource before applying the changes. 457 457 if ( $image instanceof WP_Image_Editor ) { 458 458 … … 541 541 $img = image_edit_apply_changes( $img, $changes ); 542 542 543 // scale the image543 // Scale the image. 544 544 $size = $img->get_size(); 545 545 $w = $size['width']; … … 577 577 if ( $parts['basename'] != $data['file'] ) { 578 578 if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { 579 // delete only if it's edited image 579 580 // Delete only if it's edited image. 580 581 if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) { 581 582 … … 602 603 if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) { 603 604 if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { 604 // delete only if it's edited image 605 606 // Delete only if it's edited image 605 607 if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) { 606 608 /** This filter is documented in wp-admin/custom-header.php */ … … 662 664 $sY = $size['height']; 663 665 664 // check if it has roughly the same w / h ratio666 // Check if it has roughly the same w / h ratio. 665 667 $diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2); 666 668 if ( -0.1 < $diff && $diff < 0.1 ) { 667 // scale the full size image669 // Scale the full size image. 668 670 if ( $img->resize( $fwidth, $fheight ) ) 669 671 $scaled = true; … … 694 696 $backup_sizes = array(); 695 697 696 // generate new filename698 // Generate new filename. 697 699 $path = get_attached_file($post_id); 698 700 $path_parts = pathinfo( $path ); … … 720 722 } 721 723 722 // save the full-size file, also needed to create sub-sizes724 // Save the full-size file, also needed to create sub-sizes. 723 725 if ( !wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id) ) { 724 726 $return->error = esc_js( __('Unable to save the image.') );
Note: See TracChangeset
for help on using the changeset viewer.