Remove Duplicate product Images in Magento 2

I have created a script file to delete all the duplicate product images. Here is the code I used. <?php error_reporting(E_ALL); use \Magento\Framework\App\Bootstrap; require __DIR__ . ‘/app/bootstrap.php’; $bootstrap = Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); $app_state = $obj->get(‘\Magento\Framework\App\State’); $app_state->setAreaCode(‘global’); ini_set(‘memory_limit’,’10240M’); ini_set(‘max_execution_time’, 0); set_time_limit(0); $mediaApi = $obj->create(‘\Magento\Catalog\Model\Product\Gallery\Processor’); $storeManager = $obj->get(‘\Magento\Store\Model\StoreManagerInterface’); $mediaUrl = $storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA); $directoryList=$obj->get(‘\Magento\Framework\App\Filesystem\DirectoryList’); $path = $directoryList->getPath(‘media’);…

How can i get phtml file in helper magento 2?

I have tried this solution but it is not working $this->_layout->createBlock(‘Vendor\Module\Block\Productdesigner’); $response = $layout->setData(array(“customer_data” => $result))->setTemplate(‘Vendor_Module::test.phtml’)->toHtml(); get an error when i have used above solution Invalid template file: ‘Vendor_Module::test.phtml’ in module: ‘Vendor_Module’ block’s name: ‘productdesigner_0 I have add phtml file in below path app/code/Vendor/Module/view/frontend/templates/test.phtml