Site logo

Archived topic

Additional Image Size Created by GP - How to Stop it ?

18 replies · Started by Sibi Paul on January 12, 2019

Viewing posts 1–15 of 19

Sir...

My Site is WP Fresh Installation.

Installed GP & Removed All Default Themes.

Added Few Post and Added few Featured Images.

Image Size Uploaded 1200x800

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 768x512.

I think this Image Size is Not Generated by Wordpress.

768x512 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...

768x512 image is a NON used Image, which created by GP....

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

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' );

Where to Add This Code ?

add_filter( 'wp_calculate_image_srcset', '__return_false' );

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....

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.

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

/**
* 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' );

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

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... ?

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.

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.

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 :)

this worked....

can we simplify the code ?

This archived topic is closed to new replies.