This topic has 3 replies, 2 voices, and was last updated 9 years by Radu.

  • Author
  • #85883
     markob17
    Participant

    Hi,

    Kleo creates thumbnails sized in 44 x 44 for posts widget, 480 x 270 for related posts images, 672 x XXXX for Post thumbs, and 1038 x XXXX for full width images that I know of.

    This seems like an unnecessary amount of images, especially for anyone with more limited needs. Coupled with the default WordPress ones, the rtMedia ones, and those from Woocommerce, there is upwards of “12” images created for every image uploaded. Going to run out of HD space fast with this amount.

    If it’s not possible to force Kleo to use those of wordpress, how can I change the default size of the thumbnails that Kleo creates? I’d like to change the size of the 480 x 270 related posts images, the 672 x XXXX, and 1038 x XXXX sizes to something different.

    I also noticed that the 480 x 270 and 44 x 44 thumbnails created by Kleo don’t automatically get deleted when I delete the image from the WordPress Media Gallery. Anytime I delete an image from the WordPress Media Gallery I have to FTP in and manually delete these two image sizes from the server. Any reason why this is set up that way?

    Thank you for your time!

    #86002
     Radu
    Moderator

    Hi,

    Regarding the related posts images widget please add this code to your kleo-child/functions.php

    COPY CODE
    
    function KleoCustomImagesSizes(){
        global $kleo_config;
        //Post image sizes for carousels and galleries
        $kleo_config['post_gallery_img_width'] = 555;
        $kleo_config['post_gallery_img_height'] = 333;
    }
    add_action( 'after_setup_theme', 'KleoCustomImagesSizes' );
    

    Replace 555 and 333 with your desired images dimensions.

    Regarding the kleo recent posts widget and images, you need to modify a core file of the theme by going to wp-content/themes/kleo/lib/widgets/recent_posts.php go to line 70 and there you should see this code

    COPY CODE
    
    $image = aq_resize( $img_url, 44, 44, true, true, true );
    

    Replace 44×44 with your desired dimensions.

    Regarding to this :

    I also noticed that the 480 x 270 and 44 x 44 thumbnails created by Kleo don’t automatically get deleted when I delete the image from the WordPress Media Gallery. Anytime I delete an image from the WordPress Media Gallery I have to FTP in and manually delete these two image sizes from the server. Any reason why this is set up that way?

    We will investigate this and if is as you have described thiss will be fixed in next update.

    Best Regards

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #86110
     markob17
    Participant

    Thank you very much for the info. I was able to change the related posts images per your instruction.

    You didn’t provide the instructions to change / override the 672 x XXXX for Post thumbs, and 1038 x XXXX for full width images, however, I was able to use your other function to understand the structure a little bit. I’m not a coder but was able to figure out how customize the default Kleo thumbs using a function I pieced together using your data.

    It seems to work great for my limited needs (not using all fancy features of Kleo) and now my HD space won’t get filled quick. I had to customize the rtMedia and WooCommerce images in their settings page to match the rest of the themes sizes so now instead of 13+ images uploaded for each single image upload there is only 3 uploaded ( the 480×270, 150×150, and original). Anyways, here’s the function just in case anybody else with more limited needs like myself or who are concerned with disk space wants to try it out. Naturally it will have to be tweaked to meet their needs.

    /** Function To Override Kleo Thumbnails **/
    function kleo_thumbnail_overide() {
    add_theme_support( ‘post-thumbnails’ );
    set_post_thumbnail_size( 480, 270, true ); // Now Fixed Height And Width
    add_image_size( ‘kleo-full-width’, 0, 0 ); // Disabled this size
    }
    add_action( ‘after_setup_theme’, ‘kleo_thumbnail_overide’ );

    NOTE: The only other thing I had to do to prevent additional images from being auto created when viewing the blog masonry or other view (I am only using masonry for my blog) was to make a quick edit on the post-content-masonry.php file in my child theme. I added the following under the kleo_get_post_thumbnail_url() section to force it fixed height and width instead of dynamic height:

    $image = aq_resize( $img_url, $kleo_config[‘post_gallery_img_width’], $kleo_config[‘post_gallery_img_height’], true, true, true );

    Anyways, hope this helps anybody else out. For me, 3 images to server is better than 13+. Thank you again for providing the data to change the featured post images, wouldn’t have figured the rest of this out without it.

    #86410
     Radu
    Moderator

    Hi markob17,

    You’re welcome,

    Can i mark the topic resolved ?

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?