-
- Downloads
[IMP] base: auto resize attachment to 1080p
After some analyze on a lot of customer databases, seems like most of the time
their are performance probleme, and big store, it is due to a lot of big file
uploaded without reason. E.g. barcode, photo, ... a small one will be enough.
Now, we decided (in stable) to auto resize these pictures to 1920x1920px
by default and compress it with a quality of 80 when the source is bigger.
You can bypass this behaviour in your specific use case,
using a context key: 'image_no_postprocess' set to True.
You can disable the resize (and quality implicitely)
using an icp: 'base.image_autoresize_max_px' set to '0'.
You can change the default resize (1920x1920) format using an icp:
'base.image_autoresize_max_px' set to '<width>x<height>' (e.g. '1024x768')
You can change the default quality (80) using an icp:
'base.image_autoresize_quality' with a value between 0 and 100 where 0 skip it.
You can change the type of file that will be post process using icp:
'base.image_autoresize_extensions' (subtype of the mimetype comma separated).
Api of image has not be changed in this commit, only refactored to allow to
work with image directly without the need to encode/Decode in base64 the raw.
We decide to keep 1920x1920 by default instead of 1080p to avoid to resize
portrait picture in 1080px and stay consistent with field image_1920 that
return a 1920px image for width or height whatever the orientation.
closes odoo/odoo#78145
Signed-off-by:
Jérémy Kersten (jke) <jke@openerp.com>
Showing
- odoo/addons/base/models/ir_attachment.py 44 additions, 2 deletionsodoo/addons/base/models/ir_attachment.py
- odoo/addons/base/tests/test_ir_attachment.py 103 additions, 0 deletionsodoo/addons/base/tests/test_ir_attachment.py
- odoo/addons/test_new_api/tests/test_new_fields.py 1 addition, 1 deletionodoo/addons/test_new_api/tests/test_new_fields.py
- odoo/tools/image.py 69 additions, 17 deletionsodoo/tools/image.py
Loading
Please register or sign in to comment