Changeset 55278
- Timestamp:
- 02/07/2023 05:22:41 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-image-editor-imagick.php
r54226 r55278 504 504 } 505 505 506 if ( ( $this->size['width'] == $size_data['width'] ) && ( $this->size['height'] == $size_data['height'] ) ) { 507 return new WP_Error( 'image_subsize_create_error', __( 'The image already has the requested size.' ) ); 508 } 509 506 510 $resized = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] ); 507 511 -
trunk/tests/phpunit/tests/media.php
r55171 r55278 3772 3772 3773 3773 /** 3774 * Test that an image size isn't generated if it matches the original image size. 3775 */ 3776 public function test_wp_generate_attachment_metadata_doesnt_generate_sizes_for_150_square_image() { 3777 $temp_dir = get_temp_dir(); 3778 $file = $temp_dir . '/test-square-150.jpg'; 3779 copy( DIR_TESTDATA . '/images/test-square-150.jpg', $file ); 3780 3781 $attachment_id = self::factory()->attachment->create_object( 3782 array( 3783 'post_mime_type' => 'image/jpeg', 3784 'file' => $file, 3785 ) 3786 ); 3787 3788 $metadata = wp_generate_attachment_metadata( $attachment_id, $file ); 3789 $this->assertEquals( 3790 array(), 3791 $metadata['sizes'] 3792 ); 3793 $this->assertEquals( 3794 'test-square-150.jpg', 3795 basename( $metadata['file'] ) 3796 ); 3797 $this->assertEquals( 3798 '150', 3799 $metadata['width'] 3800 ); 3801 $this->assertEquals( 3802 '150', 3803 $metadata['height'] 3804 ); 3805 } 3806 3807 /** 3774 3808 * Add threshold to create a `-scaled` output image for testing. 3775 3809 */
Note: See TracChangeset
for help on using the changeset viewer.