Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When i remove an image size the generated srcset images are not deleted #20

Open
jeroenbraspenning opened this issue May 3, 2019 · 3 comments

Comments

@jeroenbraspenning
Copy link

When i remove an image size from the configuration and regenerate the media Timmy removes the resized images but keeps the generated srcset images. This results in a lot of unused images in the case of changing image sizes.

Is this intended behaviour?

@gchtr
Copy link
Member

gchtr commented May 3, 2019

@jeroenbraspenning No, it’s not intended. When you run Regenerate Thumbnails, it should delete all generated sizes. To investigate further, could you give me some more information?

  • Which WordPress version do you use?
  • Which Timmy version do you use?
  • Can you post the configuration for the image size you deleted?

@jeroenbraspenning
Copy link
Author

Thanks for your quick reply!

Wordpress version: Version 5.1.1
Timmy version: 0.14.0
Configuration:


// reset thumbs sizes
set_post_thumbnail_size( 0, 0 );
add_image_size( 'thumbnail', 0, 0 );
add_image_size( 'medium', 0, 0 );
add_image_size( 'medium_large', 0, 0 );
add_image_size( 'large', 0, 0 );

// set sizes
add_filter( 'timmy/sizes', function( $sizes ) {
 
    return array(
        'thumbnail' => array(
            'resize' => array( 150, 150, 'center' ),
            'name' => 'thumbnail',
            'srcset' => array(2),
            'post_types' => array( 'all' )
        ),
    );
} );


// force all image sizes to be generated upon uploading
add_filter('timmy/generate_srcset_sizes', '__return_true');

When i run regenerate image sizes with the above configuration it generates a 150px and 300px version nicely. When i remove the configuration and run regenerate again the 150px versions are removed but the 300px versions remain.

@marcoluzi
Copy link

@gchtr This seems to be fixed in v1.0.
On the other hand I noticed, that when I delete an Image in the Media Tab, the generated srcset images remain in the uploads folder. wp media regenerate does not remove them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants