Make WordPress Core

Opened 8 years ago

Last modified 13 months ago

#22100 new enhancement

Get rid of $_wp_additional_image_sizes — at Version 18

Reported by: scribu Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch needs-refresh needs-testing
Focuses: Cc:

Description (last modified by scribu)


  1. Have a solid API for working with intermediate image size definitions.
  1. Don't hardcode default image sizes; register them like any other.
  1. Introduce a 'pregenerate' arg, which will allow defining an image size that will not be automatically generated right after upload.

Related tickets: #15311, #21810

Change History (21)

8 years ago

#1 @scribu
8 years ago

  • Keywords has-patch added

22100.diff is a first stab at register_image_size(), image_size_exists() etc.

TODO: generate the post-thumbnail size during set_post_thumbnail(), to avoid CPU spikes:


#2 @scribu
8 years ago

  • Summary changed from Introduce register_image_size() to Get rid of $_wp_additional_image_sizes

#3 @ocean90
8 years ago

  • Cc ocean90 added

8 years ago

#4 @scribu
8 years ago

22100.2.diff makes add_image_size() accept an array of arguments, to avoid the hassle of deprecating it.

#5 @scribu
8 years ago

  • Description modified (diff)

#6 @prettyboymp
8 years ago

  • Cc mpretty@… added

#7 @prettyboymp
8 years ago

Patch works well, also fixes #19889

#8 @skithund
8 years ago

  • Cc toni.viemero@… added

#9 @Mamaduka
8 years ago

  • Cc georgemamadashvili@… added

#10 @prettyboymp
8 years ago

Noticed that the wp_numeric_to_assoc() function was labeled as '@since 3.6.0'. Does that mean that this is very unlikely to be included in 3.5 even though it fixes #19889?

#11 @scribu
8 years ago

  • Milestone changed from Awaiting Review to 3.5

Well, the patch was meant as a more general effort to clean up the intermediate image sizes API, but it seems simple enough to make it in 3.5.

#12 @goto10
8 years ago

  • Cc dromsey@… added

#13 @prettyboymp
8 years ago

Added patch to #15311 which uses 22100.2.diff as a base to add the late image generation.

#14 @greenshady
8 years ago

  • Cc justin@… added

#15 @johnbillion
8 years ago

  • Cc johnbillion added

#16 @scribu
8 years ago

So, there's 3 kinds of behaviours:

1) Always generate size, immediately after upload.

This is what the 'pregenerate' flag currently enables.

2) Generate file after a certain condition is met, but before it will be actually needed on the front-end.

This is what needs to be implemented for 'post-thumbnail', during set_post_thumbnail().

Doing the generation via AJAX seems like overhead, but it might actually make sense in some cases.

3) Generate file right before it's needed. See #15311.

Anyway, for 3.5, we'll probably just continue to always pre-generate post thumbnails and get rid of the 'pregenerate' flag for now, since I'm not exactly happy with the name and the use-case isn't obvious either.

Last edited 8 years ago by scribu (previous) (diff)

8 years ago

#17 @scribu
8 years ago

22100.3.diff gets rid of 'pregenerate' and sets @since tags to 3.5.

#18 @scribu
8 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.