I hase used this code :
require_once("app/Mage.php");
Mage::app();
$fullImagePath = "app/code/local/Mycompany/Import/data/images/test_picture.jpg";
$product = Mage::getModel('catalog/product');
$product->load(16);
$product->setMediaGallery (array('images'=>array (), 'values'=>array ()));
$product->addImageToMediaGallery ($fullImagePath, array ('image'), false, false);
$product->save();
to import pictures to a product.
The problem in that is that when I delete the programmatically imported picture from the backend, it stay always visible in frontend.
I don’t know what’s wrong in my code.
Thanks for help.
I think in your import code instead of doing setMediaGallery() and hard coding your image url you should,