Make WordPress Core


Ignore:
Timestamp:
02/20/2025 06:44:02 AM (13 months ago)
Author:
adamsilverstein
Message:

Media: fix full size image generation for PNG uploads.

Remove a limitation that prevented PNG uploads from generating the full sized image. Fixes a bug where using the image_editor_output_format filter would not generate full sized images as expected. The removed code was present to prevent overly large PNG image output, however this issue was resolved separately in #36477.

Props: adamsilverstein, pixlpirate, flixos90, mukesh27, azaozz.

Fixes #62900.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php

    r56559 r59844  
    8787        $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
    8888    }
     89
     90    /**
     91     * Checks that large PNG uploads generate PNG `-scaled` thumbnails.
     92     *
     93     * @ticket 62900
     94     */
     95    public function test_wp_generate_attachment_metadata_png_thumbnail_smaller_than_original() {
     96        // Use the test-image-large.png test file.
     97        $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/png-tests/test-image-large.png' );
     98
     99        $metadata = wp_get_attachment_metadata( $attachment );
     100
     101        // Check that the full sized image with `-scaled` is created for the PNG.
     102        $this->assertStringContainsString( '-scaled.png', basename( $metadata['file'] ) );
     103    }
    89104}
Note: See TracChangeset for help on using the changeset viewer.