Last active
August 29, 2015 14:03
-
-
Save ryaan-anthony/6199e03317176c2d46b0 to your computer and use it in GitHub Desktop.
Magento - remove all images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include_once("app/Mage.php"); | |
| umask(0); | |
| Mage::app('admin'); | |
| $collection = Mage::getModel('catalog/product')->getCollection(); | |
| foreach ($collection as $product){ | |
| $mediaApi = Mage::getModel("catalog/product_attribute_media_api"); | |
| $items = $mediaApi->items($product->getId()); | |
| foreach($items as $item){ | |
| $mediaApi->remove($product->getId(), $item['file']); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment