I have deleted the product image using following code
$imageProcessor = $_objectManager->create('MagentoCatalogModelProductGalleryProcessor');
$images = $product->getMediaGalleryImages();
$productGallery = $_objectManager->create('MagentoCatalogModelResourceModelProductGallery');
foreach($images as $child) {
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$productGallery = $objectManager->create('MagentoCatalogModelResourceModelProductGallery');
$productGallery->deleteGallery($child['value_id']);
$product->setMediaGalleryEntries([]);
$imageProcessor->removeImage($product, $child['file']);
$product->save();
}
Image successfully deleted.
But due to the thumbnail image existence, it is still shown in the product grid
Please help how get this thumbnail image and delete
I have tried follwoing way to get thumbnail image, but no luck.
$productData = $this->productFactory->create();
$product = $productData->load(1884);
print_r($product->getThumbnail());