There have been numerous issues for some time with the standard .csv import/export functionality of Magento when dealing with images. We’ve spent many hours scratching our heads at Impression HQ, but have found a great solution that fits well with our workflow. When it comes to uploading data into Magento, there are a few options beside premium plugins that have varying levels of success and difficulty. These are;

Magento Import/Export via CSV

Initially, for product imports, the standard importer works very well. You’re able to import every piece of product data that you require, so long as the spreadsheet is setup correctly and you have already done the work on the website to set up your configuration, categories and attribute sets. Magento have provided detailed instruction on this page for users looking to get started with importing products into Magento. The problem appears when it comes to uploading images. Various sources online (plus our experience!) indicate issues around images appearing exclusively on the store view, or the admin panel, or not at all. We’re assuming you’ve already moved your files via FTP to the media/import directory before getting started. If you have got this far and want to pursue this method, it’s worth checking the following;

  • Caches are flushed and disabled – this is standard practise for a development environment
  • Indexes are refreshed to ensure correct database information is shown on the store view
  • You are referencing relative URLs from media/import in your file name, i.e. media/import/example.jpg should be recorded on the spreadsheet as /example.jpg
  • The products you are checking in the store view are visible in that view

If you find yourself constantly on Magento’s and Stack Overflow’s website, then it may be time to move on to a different solution.

Uploading product images via the Magento Dataflow

Traditionally, the upload document would be extremely large with different columns for attributes, and images would be tagged on the end. In this method, keep everything the same, but do not add images to the first spreadsheet; instead, create a new one that contains the product’s SKU and image location. Magento allows each product to have a number of images, at different sizes – standard, ‘small’ and ‘thumbnail’. Each of these images may also have a label – some themes use this to help with on-page SEO, but it’s also useful for managing images as your store grows.

Putting this all together in to your new spreadsheet, you should have the following headings, or download an example here;

sku, image, image_label, small_image, small_image_label, thumbnail, thumbnail_label

The next step is to set up your profile within Magento. Navigate to System > Import/Export > Dataflow – Profiles. There will be default profiles already set up, but go ahead and create a new profile from the + Add New Profile button in the top right. You should see the following screen. Set up your profile with the name you choose – it’s only used as a label.

Magento Bulk Image Upload - Dataflow profiles

The important settings, everything else can be left as defaults:

  • Entity type: Products
  • Direction: Import
  • Data transfer: Interactive
  • Type: MS Excel XML
  • Spreadsheet name: (leave this empty)

Then it’s time to set up the mapping, for the following column names. This will pair your file columns with the database rows within Magento.

  • sku <–> sku
  • image <–> image
  • image_label <–> image_label
  • small_image <–> small_image
  • small_image_label <–> small_image_label
  • thumbnail <–> thumbnail
  • thumbnail_label <–> thumbnail_label

We’ve opted to use XML files rather than CSV so we don’t need to worry about escaping fields that contain special characters or commas. We had some difficulty initially when using CSV’s, so if you’re experiencing the same, opt for XML. If you’re more comfortable with CSV files, then change that one setting and adjust the two options that appear beneath it. Following this, upload your file on the left hand side, click ‘Save and Continue Edit’, then run the relevant profile from the ‘Run Profile’ option on the left.

When running the profile, you may see “Skip import row, is not valid value "" for field "type"” – the first of each of these instances is due to the header rows being included, so don’t worry.

Magento Dataflow Profile Success

Successful Magento image import.

Importing with Magento Mass Importer – Magmi

Magmi in tandem with the Image attributes processor plugin is another method of mass importing images. The process is similar, but the file type can again vary, and extra care should be taken when using Microsoft Office products as additional data can be added to CSV files. Images should still be uploaded to media/import, though in this case, this can be customised. Make sure the Image attributes processor is checked on the Magmi configuration page. Another little nicety is that if you are uploading thousands of images, you can also name the images with SKUs as the filename to speed things up. There’s more information on many of the features on the Magmi Wiki page, here

Magmi is the most technical solution as it involves the installation of a new directory of folders on the server. The pages are accessible to anyone browsing your website without adding some additional protection to this directory, so be careful when attempting this. Your host or server administrator should be able to assist in setting up some http authentication here.

If you are planning on inserting multiple images into the media gallery at a time, then there is a facility for that too – the media_gallery column accepts multiple images, semicolon-separated, i.e. /exampleimg1.jpg;/exampleimg2.jpg. Again, be sure to include the forward slash when referencing a file in the imports directory.

If you would like a walkthrough on how to use Magmi, then see this great blog here by Zurd. Also, credit where it’s due – we solved our Dataflow Profile issues partially after reading this excellent post by Ash Smith.

Aaron Dicks

Performance Director

Performance Director of Impression. Search engine optimisation, paid media and web analytics consultant. Also programmer and digital all-rounder. @aarondicks

Aaron has specialist knowledge in SEO, PPC and Analytics Consultancy.

6 thoughts on “Importing product images in Magento via Dataflow Profiles

  1. Sergio Ribas says:

    Your tutorial is very good, congratulations

    1. Aaron Dicks says:

      Thank you Sergio – glad you found this useful

  2. Adam Charles Cook says:

    With regards to the CSV/XML upload method, you didn’t instruct the user to upload the file first before running the profile. I know it’s an obvious thing to do, but for Magento beginners it might be confusing.

    Other than that, it got my product images up on Magento as .CSV was indeed a pain! Excellent article, thanks!

    1. Aaron Dicks says:

      Hi Adam
      Thanks for pointing this out. I’ll make sure that these instructions are amended in the next post revision. Aside from that, I hope you found this post useful!

  3. Mary Johnson says:

    HI Aaron,

    Feeling Great after visiting your blog about importing Product images via data flow profiles.its true that your hard work speak itself in this blog. you had discussed beautifully about different method of importing product had started your blog with basic thing which a good sign.

    Well, I am running a online store (ladies Garment Products) and i am using a image Gallery Plug-in for it, and its working for me but i want ask that is this importing Product images via data flow profiles works better for my store ? need your help!

  4. Muhammad Saeed Khan says:

    All images are stored in CATALOG_PRODUCT_ENTITY_MEDIA_GALLERY and the thumbnail, image and small_image in CATALOG_PRODUCT_ENTITY_VARCHAR right? According to your CSV column format, the images will only registered in CATALOG_PRODUCT_ENTITY_VARCHAR against the EAV attributes_id’s of “image, small_image and thumbnail”. And so, the images are visible on front-end product_list page (as thumbnail) and product_view page (as product image).
    But when we go into the product options via admin Catalog > Manage Product and than click a product and then Images tab on the left side, there will be images. The reason is that, the images are not in the “CATALOG_PRODUCT_ENTITY_MEDIA_GALLERY”. This results the loss of image when we edit anything of product from admin.
    I would like to ask you that Isn’t it necessary to set the attributes “_media_image” with “_media_attribute_id” so these images get entered into the MEDIA_GALLERY table ?