Author Topic: How can I add images to products with code?  (Read 733 times)

panoss

  • Jr. Member
  • **
  • Posts: 97
  • A beginner
How can I add images to products with code?
« on: August 24, 2017, 17:05:00 pm »
I have products which have no image.
I want to add to them an image with code, not via VM GUI.
Which steps should I make?
1. add in table 'virtuemart_medias' in the product 's record, in field 'file_url', the image 's url? Something like: 'images/virtuemart/product/' .$file_title ?
2. put the image in the folder 'images/virtuemart/product/' ?
3. make an image of the appropriate dimensions and put it in the folder 'images/virtuemart/product/resized' ?
4. Something else?

How can I resample the image in order to achieve step 3? How is it applied in VM code?
Virtuemart 3.2.4 on Joomla! 3.8.0

panoss

  • Jr. Member
  • **
  • Posts: 97
  • A beginner
Re: How can I add images to products with code?
« Reply #1 on: August 24, 2017, 17:33:47 pm »
Ok, the other step was to add the imge in table 'virtuemart_product_medias'.

So I only need to know haw can I resample the image.
Where is the code of VM that does this?
Virtuemart 3.2.4 on Joomla! 3.8.0