0

As side question from solved question Odoo 10 - Show image of a given product template

Which are the differences between returning this one:

   product_image = self.browse(product_id).image
   image = product_image and product_image.decode('base64') or None
   return tools.image_resize_image_big(image.encode('base64'))

and this:

   product_image = self.browse(product_id).image
   return product_image

where in both cases self is an instance of product.template

Image is going to be used-displayed in:

   <field widget="image" class="oe_avatar"/>
M.E.
  • 4,955
  • 4
  • 49
  • 128

1 Answers1

0

The Image data may contain the Extra characters, You can see this by display the values of Image in log. So to do manipulations we need to encode them and later decode the same item. I am also not good to prove this methods but I can give you the reference links to get gain something about this.

  1. reference 1

  2. reference 2

  3. reference 3
Hilar AK
  • 1,655
  • 13
  • 25
  • Thanks, doubt is related to: tools.image_resize_image_big . I assume that decode and reencode is just needed for that command. I guess this is Odoo specific. – M.E. Aug 17 '17 at 09:46