Skip to content

Instantly share code, notes, and snippets.

@ryaan-anthony
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save ryaan-anthony/6199e03317176c2d46b0 to your computer and use it in GitHub Desktop.

Select an option

Save ryaan-anthony/6199e03317176c2d46b0 to your computer and use it in GitHub Desktop.
Magento - remove all images
<?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