News:

Support the VirtueMart project and become a member

Main Menu

How can I add images to products with code?

Started by panoss, August 24, 2017, 17:05:00 PM

Previous topic - Next topic

panoss

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

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