Community mailing list archives

community@mail.odoo.com

How to determine the url of a product image ?

by
Hieu Nguyen
- 10/27/2015 07:27:09
Hi everyone,

As I understand, product images are either stored in as binary in the Odoo database or filestore in Odoo 9.
When we use a template like below, Odoo will provide the the correct link to the image, so the web page and the product image will rendered correctly on browsers.
                <span itemprop="image" t-field="product.image" t-field-options='{"widget": "image", "class": "product_detail_img", "alt-field": "name"}'/>

Is there a way to determine a product image url, for example: `/web/image/product.template/534/image?unique=68b87dc` in python code?

I'm writing a module to generate a list of products and their corresponding image links and save it in a text file.

Thankfully,
Hieu