Remove existing Media Gallery allows you to avoid image duplication issue during the image import, you can use it to add multiple images after product import.
<?php $product = Mage::getModel ( 'catalog/product' ); $product_id = $product->getIdBySku ( $sku); $product->load ( $product_id ); /** * BEGIN REMOVE EXISTING MEDIA GALLERY */ $attributes = $product->getTypeInstance ()->getSetAttributes (); if (isset ( $attributes ['media_gallery'] )) { $gallery = $attributes ['media_gallery']; //Get the images $galleryData = $product->getMediaGallery (); foreach ( $galleryData ['images'] as $image ) { //If image exists if ($gallery->getBackend ()->getImage ( $product, $image ['file'] )) { $gallery->getBackend ()->removeImage ( $product, $image ['file'] ); } } $product->save (); } /** * END REMOVE EXISTING MEDIA GALLERY */ try { $galleryData = explode ( ';', $value ); foreach ( $galleryData as $gallery_img ) /** * @param directory where import image resides * @param leave 'null' so that it isn't imported as thumbnail, base, or small * @param false = the image is copied, not moved from the import directory to it's new location * @param false = not excluded from the front end gallery */ { $product->setMediaGallery ( array ('images' => array (), 'values' => array () ) ); if (file_exists ( Mage::getBaseDir ( 'media' ) . DS . 'import' . $gallery_img )) { $product->addImageToMediaGallery ( Mage::getBaseDir ( 'media' ) . DS . 'import' . $gallery_img, array ("thumbnail", "small_image", "image" ), false, false )->save (); } } } catch ( Exception $e ) { echo $e->getMessage (); }