Bulk Deleting Images

Hi Everyone,

I would like to know the best way to do the following:

1- Bulk deleting images of many products?

2- Bulk deleting images from the server of the product deleted images

Thank you

E.g. use the following code

$product_ids = [1,5,7,15,100]; // IDs of required products
foreach ($product_ids as $pid) {
    fn_delete_image_pairs($pid, 'product');