[wp-trac] [WordPress Trac] #39813: Add_Image_Size: Extra Parameter - Limit thumbnail-size generation to custom post type
WordPress Trac
noreply at wordpress.org
Wed Feb 8 16:52:58 UTC 2017
#39813: Add_Image_Size: Extra Parameter - Limit thumbnail-size generation to custom
post type
-------------------------+-----------------------------
Reporter: tifosi | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 4.7.2
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
I noticed a thread on the forum which itched a frustration I increasingly
have with image handling in WordPress, particularly after v3. I couldn't
see any related TRAC enhancement request.
[https://wordpress.org/ideas/topic/limit-thumbnail-size-generation-to-
custom-post-type/]
For complex CMS-style sites that have extensive usage of custom post
types, taxonomies, and meta data - using the increasingly available
plugins like ACF for image meta, it is quite often that a site will
register multiple calls to add_image_size to provide all the template
layouts required.
Herein lies the problem: add_image_size is agnostic to the image size and
simply iterates through the registered intermediate image sizes to
generate an image for each size, irrespective of whether it's ever needed,
or will be used.
Add on the generic Wordpress sizes: thumbnail, medium, large etc and you
have a recipe for a file system full to the brim with useless images.
It would be extremely useful for the function to have:
1. An additional parameter to restrict the post_type usage via the
intermediate_sizes global probably, so that dynamic image generation has
some direction.
2. A filter to restrict the image generation, e.g
add_{post_type}_image_size:
{{{
add_filter( 'add_event_image_size', function( $sizes ) { return
['event_thumbnail', 'event_category' ]; }, 10,1);
}}}
Thinking out loud on that one, depends on the codebase.
3. Both.
Really hope that when the current 4.7-4.8 focus on the WP-API is completed
that a new focus on media handling is looked at. This is a feature
requested by many, and needed for a while.
Noted enhancements: #35775, #15311
Thanks
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39813>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list