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

Page 2 of 2
How do I upload one image to multiple products? 
 
juicycreative
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2008-10-17
Phoenix, AZ
 

I would like an answer to this as well, I have configurable products which have variations, all using the same image, it’d be handy to be able to update the image once, instead of 9 times per configurable product.

I looked at doing it via db query too and found image attributes in multiple tables and moved on after realizing it wouldn’t be a single table update. Any help on this would be greatly appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
swright
Member
 
Total Posts:  37
Joined:  2009-09-29
 

any answer to this question yet? as this would be handy for me too

 
Magento Community Magento Community
Magento Community
Magento Community
 
dave.sloan
Jr. Member
 
Total Posts:  7
Joined:  2010-02-10
 

I’m looking for a solution to this problem as well.  Ideally it would be possible from the Admin Console.  A simple select-all product and image, upload would be ideal.

 
Magento Community Magento Community
Magento Community
Magento Community
 
DamonT
Sr. Member
 
Total Posts:  153
Joined:  2009-10-02
 

I will try to build a module if I get time, but if someone else comes across this please let us know.

Thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
 
DamonT
Sr. Member
 
Total Posts:  153
Joined:  2009-10-02
 

Hey guys I got this Working with a quick and dirty trick. here is what I did:

A. create an attribute
B. find the line that is calling the original image and replace it with following:

<?php echo $this->htmlEscape($product->getData('YOUR_ATTIBUTE_CODE'));?>

but this would do it for all images that is using that template so if you like to be able to select which products this should apply to you need a boolean attribute, in that case do followig:

A. create a boolean Attribute (yes/no value)

B.  find the line that is calling the original image. above it add :

<?php if($_product->BOOLEAN_ATTRIBUTE_CODE()){
 
echo $this->htmlEscape($product->getData('YOUR_ATTIBUTE_CODE'));
} ?>

<?php 

else 

?>

the original code that calls the images should go here.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hawks1
Member
 
Total Posts:  49
Joined:  2009-07-06
 

Hmm , should be not a good idea ....
I meet headache on same picture for some kinds of products too . quite waste time to upload some picture to some products .

And , it cause magento become quite big & complicated . Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Timofey
Jr. Member
 
Total Posts:  6
Joined:  2009-11-30
 

I need answer to this question too

 
Magento Community Magento Community
Magento Community
Magento Community
 
jakber
Jr. Member
 
Total Posts:  2
Joined:  2011-03-17
 

I will not say this is “the” solution but is is may one the most of you should prefer:

1. Copy file “media.php” from app/code/core/mage/catalog/model/product/attribute/backend to app/code/local/mage/catalog/model/product/attribute/backend (use same case-sensetive directoy-names as in your magento installation).

2. Goto function addImage (in media.php) and insert these line after “$fileName = $dispretionPath . DS . $fileName;”:

//avoid duplicate images - START -        
        if(file_exists($this->_getConfig()->getMediaPath($fileName)) == false)
        
{
            $fileName 
$this->_getNotDuplicatedFilename($fileName$dispretionPath);

            
$ioAdapter = new Varien_Io_File();
            
$ioAdapter->setAllowCreateFolders(true);
            
$distanationDirectory dirname($this->_getConfig()->getTmpMediaPath($fileName));

            try 
{
                $ioAdapter
->open(array(
                    
'path'=>$distanationDirectory
                
));

                if (
$move{
                    $ioAdapter
->mv($file$this->_getConfig()->getTmpMediaPath($fileName));
                
else {
                    $ioAdapter
->cp($file$this->_getConfig()->getTmpMediaPath($fileName));
                    
$ioAdapter->chmod($this->_getConfig()->getTmpMediaPath($fileName), 0777);
                
}
            }
            
catch (Exception $e{
                Mage
::throwException(Mage::helper('catalog')->__('Failed to move file: %s'$e->getMessage()));
            
}
        }
        
//avoid duplicate images - END -
The next line after this block should be “$fileName = str_replace(DS, ‘/’, $fileName);”. Remove all other code lines in between.

3. Goto function _moveImageFromTmp (in media.php) and insert these line after “$destFile = dirname($file) . $ioObject->dirsep()
. Varien_File_Uploader::getNewFileName($this->_getConfig()->getMediaPath($file));”:

//avoid duplicate images - START -
        if(file_exists($this->_getConfig()->getMediaPath($file)) == false)
        
{
            $ioObject
->mv(
                
$this->_getConfig()->getTmpMediaPath($file),
                
$this->_getConfig()->getMediaPath($destFile)
            );
        
}else
        {
            $ioObject
->rm($this->_getConfig()->getTmpMediaPath($file));
            
$destFile $file;
        
}
        
//avoid duplicate images - ENDE -
Next line should be “return str_replace($ioObject->dirsep(), ‘/’, $destFile);”. Remove all other lines in between.

With these changes I import around 500 products with just 3 images in media/catalog/...-folder. When saving the products I use “$product->addImageToMediaGallery($imageFileName, array(’image’, ‘small_image’, ‘thumbnail’), false, false);” (magento-function) to save the images for the product.

If you don’t want to make the changed manually, look at the attachment of this post.

Good luck!

*info* This works in my magento 1.4.0.2 installation. Don’t know what happens in others.

*remark* I’m not quite sure of all side-effects which this change would have.

File Attachments
Media.php  (File Size: 21KB - Downloads: 66)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

You can share set of images across multiple products with the Image Templates module.
What is important, if you’ll need to modify the image - you need to do it in one place only.

 
Magento Community Magento Community
Magento Community
Magento Community
 
RustyMic
Jr. Member
 
Total Posts:  5
Joined:  2008-11-11
 

Hi,

I need help with this. I have 100 products. I uploaded an image to 1 of them and want to use the same image for the other 99 products. So I exported my products to a csv and copied the image data for the 1 product and pasted to all other 99. During the import I kept getting “Image does not exist.” error for all lines and only 1 row imported successfully. What am I doing wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mehradev
Jr. Member
 
Total Posts:  1
Joined:  2013-02-06
 

I don’t think that posting images is a difficult task.

 
Magento Community Magento Community
Magento Community
Magento Community
 
RustyMic
Jr. Member
 
Total Posts:  5
Joined:  2008-11-11
 
mehradev - 06 February 2013 09:48 PM

I don’t think that posting images is a difficult task.

So are you able to answer my question then?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2