Timber\ImageHelper::add_actions PHP Method

add_actions() protected static method

Deletes all resized versions of an image when the source is deleted or its meta data is regenerated
protected static add_actions ( )
    protected static function add_actions()
    {
        add_action('delete_attachment', function ($post_id) {
            \Timber\ImageHelper::_delete_generated_if_image($post_id);
        });
        add_filter('wp_generate_attachment_metadata', function ($metadata, $post_id) {
            \Timber\ImageHelper::_delete_generated_if_image($post_id);
            return $metadata;
        }, 10, 2);
    }