timmy
timmy copied to clipboard
When i remove an image size the generated srcset images are not deleted
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?
@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?
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.
@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.