3

Can we update a own defined product image path to database, I am adding products with own custom code.I want to add image database without help of

->addImageToMediaGallery()

Is it doable?? without using this line i want to add direct path // external url to database

# media gallery initialization
->setMediaGallery(array('images' => array (), 'values' => array ())) 
# assigning image, thumb and small image to media gallery
->addImageToMediaGallery('xxx/my.jpg', array('image', 'thumbnail', 'small_image'), false, false)
0

Magento keep images path in media/catalog/product/ then if your image name is 'sampleimage.jpg' then magento creates a directory name taken as the first and second letter from the image name then create like below.

media/catalog/product/s/a/sampleimage.jpg

So, if you want to change the magento images path, this will lead you to change core functionality.Changing core functionality for this purpose is not advisable from me.

Edit: for your question,

you can add own path, then if you use addImageToMediaGallery($file,$mediaAttribute = null,$move = false,$exclude = true) method for saving image, the $move parameter is the exact one you need to change for your problem.

if it is true then it move the image from the file path you have given.
if it is false then it copies the image.(so image remains in filepath).

Edit:

This QUESTION WILL HELP YOU.

|improve this answer|||||
  • No,No need to upload / move the image, i want to update the database only.directly, I am inserting products using this inchoo.net/magento/programming-magento/…, the problem is that i want to upload the image path only as i have not the image,Because the image will be display from other server – user3040570 Nov 28 '14 at 9:22
  • Oh ok,This link will help you. – Manikandan Arunachalam Nov 28 '14 at 9:26
  • This is for Magento Go – user3040570 Nov 28 '14 at 9:32
  • Sorry , is there any another way to solve this? – user3040570 Nov 28 '14 at 10:53
0

The images are stored in the table catalog_product_entity_media_gallery (for gallery) and in catalog_product_entity_varchar (for image, small image and thumbnauil)

You can change them using direct db queries like this

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.