[wp-trac] [WordPress Trac] #30874: adjust add_image_size generation point

WordPress Trac noreply at wordpress.org
Wed Dec 31 21:18:12 UTC 2014


#30874: adjust add_image_size generation point
-------------------------+-----------------------------
 Reporter:  drrobotnik   |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:  4.1
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 There was a discussion in the WP Slack channel on the method of handling
 on the fly image generation using add_image_size as the whitelist for
 images that are allowed to be generated.

 I'm aware this is a long outstanding issue... Related: #15311, #21295,
 #8599. This is my first stab at the approach discussed in the #feature-
 respimg channel. I sure my patch will need to be modified.


 === Goals ===
 * Only generate thumbnail, large, and cropped images on file upload.
 * allow on-the-fly image resizes through existing wp_get_attachment_()
 functions for sizes defined using add_image_size

 === Approach ===
 Currently when a theme requests an image size that doesn't exist, WP runs
 through the image_get_intermediate_size function to get the closest match.
 My alteration is to first check if the $size string provided exists within
 the list of intermediate sizes. If so, generate that new size, update the
 attachment meta (so that future requests bypass this check entirely), and
 return the information as expected.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30874>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list