Make WordPress Core

Opened 20 months ago

Last modified 20 months ago

#58155 new enhancement

Add filter to allow large image scaling of PNGs

Reported by: pelstudio's profile pelstudio Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.3.1
Component: Upload Keywords: dev-feedback
Focuses: Cc:

Description

Due to Issue #48736,large image downscaling of PNGs is disabled because sometimes the new images are larger in filesize than the originals (particularly with PNG-8).

This is reasonable but should be filterable with the current state as the default.

There are use cases where users rarely, if ever, upload PNG-8s but do upload massive PNG-24s that would benefit from downscaling. Devs should be able to turn this feature on for PNGs as needed.

Change History (3)

#1 follow-up: @costdev
20 months ago

  • Version changed from 6.2 to 5.3.1

Hi @pelstudio, welcome to Trac and thanks for opening this ticket!

As this was introduced in 5.3.1, I'll update the Version property to note when this first became an issue.

It looks like we could change this condition:

<?php
if ( $imagesize['mime'] !== 'image/png' ) {

to:

<?php
if ( 'image/png' !== $imagesize['mime'] || apply_filters( 'big_image_scale_png', false, $imagesize, $file, $attachment_id ) ) {

@azaozz What do you think about this?

Last edited 20 months ago by costdev (previous) (diff)

#2 @costdev
20 months ago

  • Keywords dev-feedback added

#3 in reply to: ↑ 1 @pelstudio
20 months ago

Replying to costdev:

As this was introduced in 5.3.1, I'll update the Version property to note when this first became an issue.

Apologies for that. Still learning the system. We have a couple others potential issues to report so will hopefully do a better job.

It looks like we could change this condition:

to:

<?php
if ( 'image/png' !== $imagesize['mime'] || apply_filters( 'big_image_scale_png', false, $imagesize, $file, $attachment_id ) ) {

That would do it from our perspective. Would love to see this!

Version 0, edited 20 months ago by pelstudio (next)
Note: See TracTickets for help on using tickets.