I had a problem adding a product image programatically. Here's the code I used:
$product->setImage('/test.jpg')
->setSmallImage('/test.jpg')
->setThumbnail('/test.jpg')
->addImageToMediaGallery('/test.jpg', array('image','thumbnail','small_image'), false, false);
$product = $productRepository->save($product);
When run, it throws this error:
Uncaught exception 'Magento\Framework\Exception\LocalizedException' with message 'There is no MediaGalleryEntryConverter for given type' in vendor/magento/module-catalog/Model/Product/Attribute/Backend/Media/EntryConverterPool.php:48
when I save product and try to update like this link: $product->save();
Throws this error:
Fatal error:Uncaught InvalidArgumentException: Required parameter 'theme_dir' was not passed in .../vendor/magento/framework/View/Design/Fallback/Rule/Simple.php:61
Any ideas ?