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)
Best Answer
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.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.Edit:
This QUESTION WILL HELP YOU.