When creating products, administrators need to add product images and also select appropriate image types manually. Therefore, why don’t we import product images to Magento 2 via a CSV file including necessary image data and product SKU? This method will save much time and effort for store owners or administrators in the process of adding products and managing product images.
In this articles, we want to give you a detailed tutorial about how to import product images to Magento 2 by only a CSV file.
For more articles about Magento 2 Import functions, please take a look at our series as below:
- A Complete Guide on Product Import and Export in Magento 2
- How to Import Product Attributes in Magento 2
- How to Import URL Rewrites to Magento 2
- How to Import Product Reviews to Magento 2
First of all, I want to explain more about how Magento 2 supports importing product images to help you get a better understanding.
The CSV file contains the path and file name of each product image, and the imported image files are uploaded to the corresponding path on the Magento server or external server.
Besides, Magento has a directory structure for product images, and when exporting product data with available images to a CSV file, the alphabetized path can be seen before the file name of each image. In case, you want to import new images, it is not necessary to specify a path because the directory structure is managed automatically. You just have to enter the relative path to the import directory before importing the file name of each image.
Additionally, it is mandatory to login credentials and correct permissions to access to the Magento folder on the server if you want to upload an image.
After you have clearer information about Magento support, below are the 2 methods we want to introduce you to import product images via a CSV file.
Magento 2 Import Product Images from the Local Server
- Step 1: You need to upload the image files to pub/media/import folder on Magento server.
[magento installation folder]/pub/media/import
It is also possible to use another folder on the Magento server, but you have to specify the path to the folder during the import process.
- Step 2: In the row of the CSV file, you fill in the name of each image file to be imported by SKU. In the correct column of the CSV file, you fill the name of each image file by image types such as base_image, small_image, thumbnail_image, or additional_images.
*Note: If images belong to in the default import folder (/pub/media/import), you should not include the path before the file name in the CSV data.
- Step 3: Import product images to Magento 2
You do default steps as in this Import tutorial we already provided before.
In Select File to Import: you have to fill the relative path in Images File Directory:
In case you have a single SKU but want to import multiple product images, you need to insert a blank row below the SKU, and then enter the additional image file names in the appropriate columns. This means that the additional rows belong to the parent Sku.
Magento 2 Import Product Images from External Server
- Step 1: You upload the imported images to the specified folder on the external server.
- Step 2: In the CSV file, you fill the full URL of each image file in the appropriate column which stands for image types such as base_image, small_image, thumbnail_image, or additional_images.
For instance: http://abc.com/images/image.jpg
- Step 3: You do default steps as in other Import tutorials we already provided before.