WordPress.org

Ready to get started?Download WordPress

Ideas

Limit thumbnail-size generation to custom post type

  1. gerald@WPcustoms
    Member

    12345

    Hello,
    After going through the codex pages for all thumbnail related pages I didn`t find a way to limit the thumbnail creation to a specific post type.

    let`s say you have a custom post type for "books" and thumbnails are 260x260. WordPress creates the 260x260 jpg for every uploaded images where it should only make sense to create that specified size for images uploaded within the BOOKS custom post type.

    add_theme_support( 'post-thumbnails', array( 'books' ) );
      add_image_size( 'book-thumbnails', 260, 260, false );

    having another parameter for add_image_size which works similar to dependancies (wp_register_script) would help to limit it to the post type.
    i.e.
    add_image_size( $name, $width, $height, $crop, $post_type );

    I assume the default thumb\medium\large sizes in the /media.php setting are responsible for many never-used images. I would leave these settings completely up to the theme developer who should decide the size for thumbnail\medium\large. And only create these sizes IF they are specified in the theme or entered manually in /media.php

    imagine the ressources you would be able to save with an extended thumbnail configuration. (backup space and bandwidth; cpu load, diskspace, fragmentation etc.)
    I know a few wordpress users who messed up their upload folder with seveal thousand image files while only using maby 100 or 200 images on the site itself. They didn't even know about it and just wondered why their backup zips are >500MB.

    Posted: 1 year ago #
  2. Cara Peckens
    Member

    12345

    +1 for this idea.

    Posted: 1 year ago #
  3. heartbox
    Member

    12345

    +1

    Posted: 1 year ago #
  4. superpikar
    Member

    12345

    great, will save lot of space

    Posted: 6 months ago #
  5. +1, really! :)

    Posted: 6 months ago #
  6. Harish Chouhan
    Member

    12345

    +1. This would make so much sense as now WordPress is used for more than blogging.

    Posted: 2 months ago #
  7. evster
    Member

    12345

    More like +100 :)

    I've been wanting a feature like this for years now!

    Posted: 2 months ago #
  8. Shahed
    Member

    12345

    Its very important for a large site with huge images where different image sizes are needed for different post types.

    Posted: 2 weeks ago #
  9. syrupcore
    Member

    12345

    While I can understand the current 'keep it simple' model, this change seems like a pretty natural extension. In addition to saving server space/back up space and bandwidth there are a couple of benefits I can think of.

    Benefit 1: Image sizes change. Thumbnail regeneration takes time. Limiting the scope of those operations are a good thing.

    Benefit 2: Brain space for content creators on sites that use manual image cropping plugins for different image sizes (basically required for 'art directed' image crops). As it is now, if you load up one of the handy image cropping plugins, you get views for every single image size you've registered even if only two of them are relevant for the current image.

    I'd want $post_type to be optional so:

    add_image_size( $name, $width, $height, $crop );

    would generate the thumbnail for all post types.

    Posted: 1 week ago #
  10. micahjm
    Member

    12345

    +1. This would be incredibly helpful.

    Posted: 2 days ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    14 Votes
  • Status

    Sorry, not right now