WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 4 days ago

#48111 assigned defect (bug)

Update usage of `multi_resize` to utilize new `wp_create_image_subsizes()` function

Reported by: antpb Owned by: mikeschroder
Milestone: 5.4 Priority: normal
Severity: normal Version: trunk
Component: Media Keywords: needs-patch
Focuses: Cc:
PR Number:

Description

As mentioned in https://core.trac.wordpress.org/ticket/40439#comment:61

There are two uses of multi_resize() that will need to be updated to use the new wp_create_image_subsizes() function introduced in #40439.

Attachments (3)

48111.patch (2.5 KB) - added by progremzion 4 weeks ago.
48111.2.patch (1.0 KB) - added by azaozz 9 days ago.
48111.3.patch (6.4 KB) - added by mikeschroder 8 days ago.
48111.2.patch + Automated Test Updates

Download all attachments as: .zip

Change History (17)

#1 @antpb
4 weeks ago

  • Version set to trunk

This ticket was mentioned in Slack in #core by antpb. View the logs.


4 weeks ago

#3 follow-up: @progremzion
4 weeks ago

  • Keywords has-patch needs-testing added; needs-patch removed

Hi @antpb

I have fixed the issue. Can you please review? I am new to core contribution, so please do let me know if something is missing.

Thanks!

@progremzion
4 weeks ago

This ticket was mentioned in Slack in #core-media by mike. View the logs.


3 weeks ago

#5 in reply to: ↑ 3 @azaozz
3 weeks ago

  • Keywords needs-patch added; has-patch needs-testing removed

Replying to progremzion:

Unfortunately 48111.patch doesn't work as expected. We can switch to the new wp_create_image_subsizes() or _wp_make_subsizes() but that may also need handling of PHP fatal errors while processing images.

Also it introduces a regression in _wp_make_subsizes(). It should be able to fall back to $editor->multi_resize() in case a plugin adds another class for processing images that is missing the new make_subsize method.

(Also next time could you make diffs from the root WP dir, the parent of /src).

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


2 weeks ago

#7 @marybaum
10 days ago

  • Milestone changed from 5.3 to Future Release

Punting -- we're running out of time. If you can commit before RC1, excellent!

#8 @mikeschroder
9 days ago

  • Milestone changed from Future Release to 5.3

I'd like this in the 5.3 milestone still -- I'll take care of moving it if necessary.

Thanks!

#9 @mikeschroder
9 days ago

  • Owner set to mikeschroder
  • Status changed from new to assigned

This ticket was mentioned in Slack in #core-media by mike. View the logs.


9 days ago

@azaozz
9 days ago

#11 @azaozz
9 days ago

  • Keywords has-patch needs-testing added; needs-patch removed

In 48111.2.patch: use the new _wp_make_subsizes() when creating image thumbnails for PDFs (untested).

Unfortunately this is not as straightforward to implement for the image editor. It was designed to "wait" for all operations to complete before it saves all the meta data, including the meta "backup" for previous versions of the image. I'll need a refactoring, best to do in 5.4.

@mikeschroder
8 days ago

48111.2.patch + Automated Test Updates

#12 @mikeschroder
8 days ago

@azaozz Thanks so much!

I had been working on this separately and had something very similar, but this covers more cases!

Went ahead and updated the automated tests to account for the change in image generation order.

You'll find 48111.2.patch + those changes in 48111.3.patch.

So far in testing, things are working as expected.

#13 @mikeschroder
8 days ago

In 46459:

Media: Update fallback previews to support _wp_make_subsizes()

Allows fallback previews (PDF by default, in core) to save image meta
after each size is generated to allow for resuming, and make sizes
immediately available.

Props azaozz, antpb, progremzion, mikeschroder.
See #48111.

#14 @mikeschroder
4 days ago

  • Keywords needs-patch added; has-patch needs-testing removed
  • Milestone changed from 5.3 to 5.4
  • Type changed from task (blessed) to defect (bug)

Left here is moving the image editor to use _wp_make_subsizes().

I agree this is more complicated and think it's fine to ship with the other parts of WordPress supporting the functionality.

To keep the conversation in the same place, going to move this to 5.4 for consideration, and change it from a task for clarity.

Note: See TracTickets for help on using tickets.