Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug that would prevent uploaded images from being converted to the intended output format when having fallback formats enabled #1635

Merged
merged 7 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion plugins/webp-uploads/tests/test-image-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public function test_it_should_restore_the_sources_array_from_the_backup_when_an

wp_restore_image( $attachment_id );

$this->assertImageNotHasSource( $attachment_id, 'image/jpeg' );
$this->assertImageHasSource( $attachment_id, 'image/webp' );

$metadata = wp_get_attachment_metadata( $attachment_id );
Expand Down
5 changes: 0 additions & 5 deletions plugins/webp-uploads/tests/test-load.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function test_it_should_not_create_the_original_mime_type_for_jpeg_images

// There should be an image_type source, but no JPEG source for the full image.
$this->assertImageHasSource( $attachment_id, $mime_type );
$this->assertImageNotHasSource( $attachment_id, 'image/jpeg' );

$metadata = wp_get_attachment_metadata( $attachment_id );

Expand Down Expand Up @@ -263,8 +262,6 @@ public function test_it_should_create_a_webp_version_with_all_the_required_prope
$file = get_attached_file( $attachment_id, true );
$dirname = pathinfo( $file, PATHINFO_DIRNAME );

$this->assertImageNotHasSource( $attachment_id, 'image/jpeg' );

$this->assertImageHasSource( $attachment_id, 'image/webp' );
$this->assertFileExists( path_join( $dirname, $metadata['sources']['image/webp']['file'] ) );
$this->assertSame( $metadata['sources']['image/webp']['filesize'], wp_filesize( path_join( $dirname, $metadata['sources']['image/webp']['file'] ) ) );
Expand All @@ -285,7 +282,6 @@ public function test_it_should_create_the_full_size_images_when_no_size_is_avail
$metadata = wp_get_attachment_metadata( $attachment_id );
$this->assertEmpty( $metadata['sizes'] );

$this->assertImageNotHasSource( $attachment_id, 'image/jpeg' );
$this->assertImageHasSource( $attachment_id, 'image/webp' );
}

Expand Down Expand Up @@ -706,7 +702,6 @@ static function ( $editors ) {
$this->assertArrayHasKey( 'sources', $metadata );
$this->assertIsArray( $metadata['sources'] );

$this->assertImageNotHasSource( $attachment_id, 'image/jpeg' );
$this->assertImageHasSource( $attachment_id, 'image/' . $image_type );

$this->assertImageNotHasSizeSource( $attachment_id, 'thumbnail', 'image/jpeg' );
Expand Down
Loading