Magento 2.1 – Import Product with Images Using Absolute Path

image-uploadimportimportexportmagento-2.1product-images

As the product images are well organized in shared folders on the server, I prefer having the absolute image path in the CSV file directly. For example this allows for simple one click (almost) imports without having to look for the right folder for a specific brand. This also has the advantage of storing a unique copy of each product images used by multiple production/development installations without having to duplicate them which would occupy much more disc space.

While trying to import product images using an absolute path either with the entire path inside the CSV file, submited through the Images File Directory parameter or both, this error was thrown.

Following Error(s) has been occurred during importing process:

  1. Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in row(s): 1, 2, 4, …

The ideal solution would allow to import from any web user accessible folder using an absolute path while allowing to store a part or the entire path in the CSV file before the image name.

Best Answer

With a small trick, I was able to use an absolute path to import the product images.

Magento way of retrieving the final folder is based on the current Magento installation location, therefore any root based path parameter won't go through. I was able to tric the Magento import system using /../. This allows to reach a parent or even sibling folder on any authorized level as the final path is still based on the current Magento installation folder.

For example, if your import file path is located as below:

/home/user/import/brand/img001.jpg

And your Magento installation location:

/home/user/magento


Then the Images File Directory import setting should be set as follow:

/../import/brand

And inside the CSV file under the base_image attribute column:

img001.jpg

Unfortunately this method still does not allow to include the path or a part of it in the CSV file which would have been better instead of having to input a new path on every import.

I think that Magento still has work to do in regards to their import system. At the time of writing, there is also an issue still present in the version 2.1.3 in which the verification function does not use the same Multiple value separator as the import function for the additional_images attribute. The result is that if any delimiter other than comma is used as Multiple value separator, the validation process will fail.

Related Topic