Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Import product images from an external link
 
vishal_2811
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2011-04-17
 

Hi All,

After hitting a lot on google I found a very good article in order to import images from an external link (lets say image column contain http://somesite.com/images/abc.jpg). It worked for me.

http://www.semtruth.com/importing-images-from-external-url-into-magento/

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Mentor
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

Hi Mage Folks

Instead of using curl we can easily get the external image to our folder by just using
file_get_contents() & file_put_contents().
for more:
http://www.blog.magepsycho.com/how-to-import-product-images-from-external-url-in-magento/

Happy Importing!!

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
dweeves
Enthusiast
 
Total Posts:  877
Joined:  2010-06-26
FRANCE
 

Just to add:

magmi is natively able to import remote images and do many other advanced things for importing products that even magento importer is not able to.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mizan_nd
Jr. Member
 
Total Posts:  1
Joined:  2012-11-14
 

Hey all,
there are complete solution for \"Image Imported from external URL with CSV file in Magento(ver. 1.7.0.2)\” :-
Coping the file from this location : htdocs\\magento_store\\app\\code\\core\\Mage\\Catalog\\Model\\Convert\\Adapter\\Product.php
and Paste into : htdocs\\magento_store\\app\\code\\local\\Mage\\Catalog\\Model\\Convert\\Adapter\\Product.php
Open \"Product.php\" with your existing editor
Find the code around on line 763 (it would be different in your in your file)

foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) {
if (isset($importData[$mediaAttributeCode])) {
$file = trim($importData[$mediaAttributeCode]);
if (!empty($file) && !$mediaGalleryBackendModel->getImage($product, $file)) {
$arrayToMassAdd[] = array(\’file\’ => trim($file), \’mediaAttribute\’ => $mediaAttributeCode);
}
}
}

Replace with this:

foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) {
if (isset($importData[$mediaAttributeCode])) {
$file = trim($importData[$mediaAttributeCode]);
if (!empty($file) && !$mediaGalleryBackendModel->getImage($product, $file)) {
//echo $file;
//Starting to Import Image from external URLs
$file = parse_url($file);
$file = $file[\’scheme\’].\"://\".$file[\’host\’].$file[\’path\’];
//echo $file;
if (preg_match(\’&#xht;tps?://[a-z0-9\\-_./]+\\.(?:jpe?g|png|gif|jpg)%i\’, $file)) {
//echo \"I am Bangladeshi\”;
$path_parts = pathinfo($file);
$html_filename = DS . $path_parts[\’basename\’];
$fullpath = Mage::getBaseDir(\’media\’) . DS . \’import\’. $html_filename;
//echo $fullpath;
if(!is_dir(Mage::getBaseDir(\’media\’) . DS . \’import\’.DS)){
mkdir(Mage::getBaseDir(\’media\’) . DS . \’import\’, 0777);
}
//echo \"</br> ---- \".$fullpath.\" ----- </br>\”;
if(!file_exists($fullpath)) {
$ch = curl_init ($file);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$curl_return=curl_exec($ch);
//echo $curl_return;
curl_close ($ch);
if(file_exists($fullpath)) {
unlink($fullpath);
}
$fp = fopen($fullpath,\’w\’);
fwrite($fp, $curl_return);
fclose($fp);
}
$arrayToMassAdd[] = array(\’file\’ => trim($html_filename), \’mediaAttribute\’ => $mediaAttributeCode);
}
else{
$arrayToMassAdd[] = array(\’file\’ => trim($file), \’mediaAttribute\’ => $mediaAttributeCode);
}
}
}
}

Finally Save, than try to import
it u got help from this post, then leave a msg, good luck

 
Magento Community Magento Community
Magento Community
Magento Community
 
Patrick_27
Jr. Member
 
Total Posts:  6
Joined:  2012-10-02
 

Oh God....it is too difficult for me. Any other suggestions?
Anybody with other options or possibilities?
I have heard that it is possible to import your data from url using additional services/extensions.
I have tried to import products, products images and categories from CSV, and XML using this one a few times. It is great. The big plus - it is fully automated.  So it will help you to import your images (and even additional images) without any problems.
I think you should try it.

Have a nice day=))

 
Magento Community Magento Community
Magento Community
Magento Community
 
Store_Manager
Enthusiast
 
Avatar
Total Posts:  867
Joined:  2012-07-09
 

If you have some skills you can use scripts as default Magento does not support this functionality. However, remember, if you need to adjust code according to your needs, you have to be very careful.
Another way to do it is using third-party solutions like Store Manager for Magento that handles images import from remote URL\’s. For those who are interested, here is the link to download free 2-weeks version of the application -
http://www.magentocommerce.com/magento-connect/store-manager-for-magento.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
NELAGeek
Sr. Member
 
Avatar
Total Posts:  193
Joined:  2010-01-23
US
 

Hi all! We sell an extension at http://nelageek.com/external-images/ that will allow you to use remote URLs for images. Install is a breeze and it works with Magento 1.4+. Great deal for only $45US.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top