$objProduct=10; // Id of product which you want to add image…
$objprod=Mage::getModel('catalog/product')->load($objProduct);
$objprod->addImageToMediaGallery($imagepath,array('image','small_image','thumbnail'),true,false);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
//for Set it to all Store view
$objprod->save();

Be the first to comment.