This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Images upload multiple resizes, how to remove theme crop sizes

  • Creator
    Topic
  • #23466
    costeur
    Member

    Hi,

    everytime I upload an image the theme creates multiple versions of this image.
    It’s creating lots of images (around 11) and this decreases marginally my hostspace!

    Is there a way to disable/limit this. (I searched the functions.php but didn’t got far)
    Most of the images are only needed for galleries (3 collumn) and featured images.
    Hope this can be resolved because my site is image heavy.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #23478
    Jason Bobich
    Keymaster

    Hello,

    In WordPress, themes and plugins can register crop sizes. And when you upload an image, WordPress will create a cropped version for all registered crop sizes.

    Unfortunately, there is no feature for removing the theme’s crop sizes, and so it will be a code customization you’ll need to make form your child theme. Keep in mind that this will cause issues with certain image crop sizes now not being available for various features of the theme.

    Here’s more info on how crop sizes work in WordPress and how the theme registers them:

    http://dev.themeblvd.com/tutorial/crop-sizes/

    You can see in the table at the top of the article, all the ID’s for registered crop sizes by the theme. As explained in the article, before being registered, all these crop sizes come from a single array with filter “themeblvd_image_sizes” which you can utilize from your child theme’s functions.php.

    Here’s one example of an approach you could take to remove sizes by using default PHP function unset() on the sizes, knowing that the crop IDs (from the table in the article) are used as the keys of the array items.

    function my_image_sizes( $sizes ) {
         
        unset( $sizes['slider-large'] );
        unset( $sizes['slider-staged'] );
        //  etc ..
     
        return $sizes;
    }
    add_filter( 'themeblvd_image_sizes', 'my_image_sizes' );

    After making changes to crop sizes, make sure you’re regenerating your thumbnails. This plugin is helpful, and will clean out all image that were previously generated for crop sizes, which are no longer registered.

    https://wordpress.org/plugins/regenerate-thumbnails/

Viewing 1 replies (of 1 total)
  • The forum ‘Swagger Responsive WordPress Theme’ is closed to new topics and replies.