I creating a product pro grammatically in magento2. The issue is that i can't set addImageToMediaGallery. I always receive error:
The file "/home/xxx/pub/media/tmp/catalog/product/t/e/test.jpg" doesn't exist or not a file
My picture locating in /pub/media/testimg/test.jpg media folder and has 777 permissions and files has same perms. Here is a code:
$dir = $objectManager->get('Magento\Framework\App\Filesystem\DirectoryList');
$_product->addImageToMediaGallery(
$dir->getPath('media') . '/testimg/test.jpg',
null,
false,
false
);
so it looks like the system found the image but can't copy in tmp folder ? please help.