WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 3 months ago

#37311 reopened defect (bug)

Site icon thumbnails are lost if wp_generate_attachment_metadata called again later

Reported by: smerriman Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.5
Component: Media Keywords: needs-patch
Focuses: Cc:

Description

If image sizes are regenerated with the Regenerate Thumbnails plugin, the custom Site Icon sizes (and possibly other images in the customiser?) are lost.

The question is whether this is something that needs changing in the plugin, or whether the logic for how these sizes work should change in core. (Virtually all core documentation tells people to use this plugin when changing image sizes, so it should be fixed in one of the other).

I'm of the opinion it should be changed in core, where custom sizes like the ones created by Site Icons should be somehow marked as special sizes, with wp_generate_attachment_metadata checking for any existing custom sizes and including them in the output.

Change History (10)

#1 @Viper007Bond
5 years ago

OP also opened an issue on my side of things here: https://github.com/Viper007Bond/regenerate-thumbnails/issues/34

Probably on me to fix it, but it is an interesting situation.

#2 @ocean90
5 years ago

  • Version changed from trunk to 4.5

#3 @Viper007Bond
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I'll be handling this on my end by not regenerating any sizes being used for site icons. Going to close this here as wontfix as it's not really core's job to worry about this, rather the plugin that is calling wp_generate_attachment_metadata() should.

#4 @smerriman
4 years ago

Are you going to hard code in a special case for site icons, or will the logic be able to be applied to other sizes? For example, a theme I've built uses the same type of code to generate a special logo size; that also gets lost on regenerate. That's why I was thinking there needed to be some sort of flag stored with the image on core's side that the call to the function could ignore.

#5 follow-up: @joemcgill
4 years ago

  • Component changed from Customize to Media
  • Keywords reporter-feedback added
  • Resolution wontfix deleted
  • Status changed from closed to reopened

I'm not opposed to including a fix in Core for this, if one makes sense. Can we also confirm whether this behavior is reproducible when doing thumbnail regeneration via WP-CLI?

#6 in reply to: ↑ 5 @mikeschroder
4 years ago

Replying to joemcgill:

I'm not opposed to including a fix in Core for this, if one makes sense.

+1

#7 @SergeyBiryukov
3 years ago

  • Milestone set to Awaiting Review

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


3 months ago

#9 @antpb
3 months ago

  • Keywords needs-patch added; reporter-feedback removed

This was mentioned in a recent Media component bug scrub. This ticket seems to still have a valid need for a fix Core side, but has not seen attention for a bit of time. I think we could maybe learn from the fix that was added plugin side to inform what next steps we need for this ticket.

Mentioned by @joedolson in the scrub "One risk to keep in mind is that creating an exception could run into problems if changes happen to how site icons should be presented in contexts not handled by core. It creates a surprise behavior in the function if it doesn't work the same way on all images."

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


3 months ago

Note: See TracTickets for help on using tickets.