Search Here

Resize image on saving records in odoo

In this article you will learn how to create a new field to save images into database and automatically resize that image on saving and updating existing records. For example if you have uploaded 500 X 500 image, our goal is to resize that uploaded image into 250 X 250 automatically.

Resize existing image record in odoo

How to set a specific dynamic image size in Odoo

  1. To use image_resize_image function import tools library from openerp package 
  2. Create new binary field to store image into database
  3. Override Create and Write method to resize uploaded image automatically
Enjoy Free Tools: Base64 to Image Online Convertor

You can also use below functions provided by Openerp/Odoo tools library to resize uploaded image into specific predefined size.

 
Method Size
image_resize_image_big 1024 X 1024
image_resize_image_medium 128 X 128
image_resize_image_small 64 X 64

Don,t forgot to share, keep sharing keep learning

Post a Comment

0 Comments