I'm adding images to products using the addImageToMediaGallery() function like so:


$product = Mage::getModel('catalog/product')->load(1234);

try {
    $product->addImageToMediaGallery($filePath, ['small_image', 'thumbnail', 'image'], false, false);
} catch(Exception $e) {
    echo $e->getMessage();

The images are uploaded to the gallery as intended but the media attributes (small_image, thumbnail, image) seem to be ignored and are not selected on the newly uploaded image.

What I expected

I'm running Magento CE

1 Answer 1


After experimenting some more I have found a solution.

These values didn't change because there were other storeviews that didn't have "Use default value" selected


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.