Importing image from external URL using Magmi datapump

Importing image from external URL using Magmi datapump

October 16, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Importing image from external URL using Magmi datapump

Importing Image from External URL Using Magmi Datapump

The Problem: Images Not Importing Correctly

You’re facing an issue while importing products using the Magmi datapump in Magento. All your product attributes are being imported successfully, but the images aren’t showing up correctly in the backend.

The image fields (image, small_image, and thumbnail) are set to external URLs:

'image'                 => '+http://blogs.smh.com.au/entertainment/getflickd/44655_native.jpeg.jpg',
'small_image'           => 'http://blogs.smh.com.au/entertainment/getflickd/44655_native.jpeg.jpg',
'thumbnail'             => 'http://blogs.smh.com.au/entertainment/getflickd/44655_native.jpeg.jpg'

However, when you check the product in the backend, the images are blank or not displaying properly. The issue seems to be with how Magmi is handling external image URLs.

Understanding Magento’s Image Import Process

Before we dive into the solution, let’s understand what happens behind the scenes during an image import in Magento:

  1. Base URL: When you set an image path as an external URL, Magento expects it to be relative to your Base URL (set under System > Configuration > General > Web).

  2. Media Gallery: The image is saved in the media directory of your Magento installation (pub/media). The correct path should point to this directory.

  3. Image Resizing and Caching: Magento resizes images for different uses like product listing, detail page, etc., and stores them in the cache folder (var/cache).

The Solution: Correcting Image Paths

The issue lies with the image paths you’re providing. Magmi expects the URLs to be relative to your website’s base URL or a full absolute path.

Since it’s not recognizing the external URLs as valid paths, let’s try a different approach:

Method 1: Use Full Absolute Paths

You can provide the full absolute paths of the images on the remote server. For example:

'image'                 => 'http://blogs.smh.com.au/entertainment/getflickd/44655_native.jpeg.jpg',
'small_image'           => 'http://blogs.smh.com.au/entertainment/getflickd/44655_native.jpeg.jpg',
'thumbnail'             => 'http://blogs.smh.com.au/entertainment/getflickd/44655_native.jpeg.jpg'

Method 2: Download Images Locally Before Import

A more reliable method is to download the images locally before importing. You can use cURL or any other PHP library to fetch and save the images.

Here’s a simple example using cURL:

$url = 'http://blogs.smh.com.au/entertainment/getflickd/44655_native.jpeg.jpg';
$file_path = '/path/to/local/directory/image_name.jpeg';

file_put_contents($file_path, file_get_contents($url));

Replace /path/to/local/directory/ with the actual path on your server where you want to save the images.

After downloading, provide the local paths in your Magmi datapump script:

'image'                 => '/path/to/local/directory/image_name.jpeg',
'small_image'           => '/path/to/local/directory/image_name.jpeg',
'thumbnail'             => '/path/to/local/directory/image_name.jpeg'

Conclusion

In most cases, providing the full absolute paths of external images or downloading them locally before importing should resolve your issue.

Remember that Magento expects image URLs to be relative to its base URL or an absolute path. It doesn’t handle direct external URLs effectively by default.

Always ensure your server has sufficient permissions to write and read files in the media directory for successful image imports.

For more advanced data import techniques and best practices, I recommend checking out our comprehensive guide on Magento Data Import Techniques.

Catalog Admin Configuration Import/Export

Our network