Black Friday Sale! Get up to $30 off GP Premium! Learn more ➝

[Resolved] Additional Image Size Created by GP – How to Stop it ?

Home Forums Support [Resolved] Additional Image Size Created by GP – How to Stop it ?

Home Forums Support Additional Image Size Created by GP – How to Stop it ?

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #780276
    Sibi Paul

    Sir…

    My Site is WP Fresh Installation.

    Installed GP & Removed All Default Themes.

    Added Few Post and Added few Featured Images.

    Image Size Uploaded 1200×800

    When I Looks into Cpanel – File Manager – WP uploads Folder

    There are 4 Different Size of Images Showing

    One Image uploaded and WordPress generating 4 different sizes.

    So, I came to WP Dashboard and Set the Image Sizes to zero.

    Thumbnail

    medium

    Large

    all set to zero.

    ———-

    Then I removed All the Uploaded And generated Images…

    Then , Uploaded Image Again…

    There now Shows two Images,

    1 – is the Original, which actually i wanted..

    Another one is size 768×512.

    I think this Image Size is Not Generated by WordPress.

    768×512 image is not showing in my other sites They uses WP Default themes.

    in those Sites Only showing One Image – which we uploaded.

    So, Here…

    768×512 image is a NON used Image, which created by GP….

    So, Where and How, I can Stop Generating this Image size.

    GeneratePress 2.2.1
    GP Premium 1.7.7
    #780394
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    GP doesn’t create any additional image sizes unless you have sizes set in Customize > Layout > Blog.

    I believe what you’re seeing are the sizes created by WordPress to be used by srcset.

    Disabling srcset should stop those images from generating:

    add_filter( 'wp_calculate_image_srcset', '__return_false' );

    #780417
    Sibi Paul

    Where to Add This Code ?

    add_filter( ‘wp_calculate_image_srcset’, ‘__return_false’ );

    #780419
    Sibi Paul

    I added That Code in functions.php

    added bottom

    Still site creates that size images in file manager.

    if code needs to add some where else, plz let me know where….

    #780425
    Sibi Paul

    Then I added This Code in Functions.php

    function disable_srcset( $sources ) {
    return false;
    }
    add_filter( ‘wp_calculate_image_srcset’, ‘disable_srcset’ );

    that also not works, image still creating.

    #780426
    Sibi Paul

    Then i tried This

    /**
    * Disable responsive image support
    */
    // Clean the up the image from wp_get_attachment_image()
    add_filter( ‘wp_get_attachment_image_attributes’, function( $attr )
    {
    if( isset( $attr[‘sizes’] ) )
    unset( $attr[‘sizes’] );

    if( isset( $attr[‘srcset’] ) )
    unset( $attr[‘srcset’] );

    return $attr;

    }, PHP_INT_MAX );

    // Override the calculated image sizes
    add_filter( ‘wp_calculate_image_sizes’, ‘__return_false’, PHP_INT_MAX );

    // Override the calculated image sources
    add_filter( ‘wp_calculate_image_srcset’, ‘__return_false’, PHP_INT_MAX );

    // Remove the reponsive stuff from the content
    remove_filter( ‘the_content’, ‘wp_make_content_images_responsive’ );

    That also not worked

    i added in wp-dashboard>appearance>editor>function.php

    #780428
    Sibi Paul
    /**
    * Disable responsive image support
    */
    // Clean the up the image from wp_get_attachment_image()
    add_filter( 'wp_get_attachment_image_attributes', function( $attr )
    {
    if( isset( $attr['sizes'] ) )
    unset( $attr['sizes'] );
    
    if( isset( $attr['srcset'] ) )
    unset( $attr['srcset'] );
    
    return $attr;
    
    }, PHP_INT_MAX );
    
    // Override the calculated image sizes
    add_filter( 'wp_calculate_image_sizes', '__return_false', PHP_INT_MAX );
    
    // Override the calculated image sources
    add_filter( 'wp_calculate_image_srcset', '__return_false', PHP_INT_MAX );
    
    // Remove the reponsive stuff from the content
    remove_filter( 'the_content', 'wp_make_content_images_responsive' );
    #780754
    Tom
    Lead Developer
    Lead Developer
    #780761
    Sibi Paul

    Edit File in The Function.php or inc folder functions.php ?

    #780768
    Tom
    Lead Developer
    Lead Developer
    #780832
    Sibi Paul

    Oh no…

    Then your First Solution Might Work…

    i did not tried yet…

    I am adding all the codes in function.php bottom line…

    so you Saying, thats wrong ?

    Then why you not said it first… ?

    #781003
    Tom
    Lead Developer
    Lead Developer

    If it’s a child theme, the child functions.php file will work fine.

    The actual parent theme shouldn’t ever be modified, as your changes will go away when you update the theme.

    #781110
    Sibi Paul

    Very Sad, and the bad side of this forum is…

    Nobody saying things clearly.

    Simply make it Clear…

    I don’t want to wait 24 hours for each reply and that not solves my problem.

    Just Give me 3 steps

    1 – Which Code I have to Add

    2 – Where to Add

    3 – How to Add

    NOTE: if you answered this in the very first day, It could be better and I will be loved your support.

    Whatever Your Support is, I would Like to Use generate Press for my All Sites.

    And Plans Writing a Great post in my WP niche Blog.

    Meanwhile, let me know about the GP affiliate.

    #781112
    Tom
    Lead Developer
    Lead Developer

    I haven’t given you an exact solution because I’m not sure what the exact solution is. However, I’m pretty sure the solution lies in the topic I linked to above: https://wordpress.stackexchange.com/a/251810

    So you would copy this code:

    add_filter( 'intermediate_image_sizes', '__return_empty_array', 999 );

    And add it using one of these methods: https://docs.generatepress.com/article/adding-php/

    I’m sorry if our response time hasn’t been as quick as you’d like, but we try to answer everyone within 12 hours, 7 days a week.

    Hopefully the above works for you. If not, we’ll keep looking until we find a solution 🙂

    #781121
    Sibi Paul

    this worked….

    can we simplify the code ?

Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.