Commit Graph
19 Commits
Author SHA1 Message Date
Sagar Ahirrao 05e02059f0 [IMP] base: resize partner image with actual aspect ratio
Purpose of this commit is to finally stop adding extra padding to
website logo. Indeed not giving square logos lead to padding added
to images, leading to not so beautiful logo that makes people sad.

Before this commit
 * partner's image was resized to square 1024x1024. Extra padding was added
   if user provided rectangle image;
 * due to this website logo resized to square when rectangle logo provided;

After this commit,
 * sizes dict can be passed in image resizer of tools;
 * e.g. tools.image_resize_images(vals, sizes={'image': (512, 512),
   'image_small': (128, 128)})
 * image field in partner will resize with max width 1024 and height based
   on given image ratio (still image_medium, image_small will be default
   square images);
 * now website logo will respect actual aspect ratio

This commit is related to task ID 31994 . Future commits should probably
clean all that mess, but at least it seems we have something that works.
2018-03-15 11:31:06 +01:00
Christophe Simonis 8ef7af6afe [MERGE] forward port branch 11.0 up to f96a797fe6 2017-12-06 12:02:58 +01:00
Xavier Morel 150fc064fd [FIX] product: image changes not sticking everywhere
Fixes #20046

Simply reverting e5ef1c5917 looks to
work *but* since I didn't note the repro case for the issue and don't
remember what it was it may re-introduce previous breakage. Instead,
ensure all "sizes" for the image are reset if any of the sizes is
present *and* Falsy by adding a final case to the conditional.

If any of the image fields is present and non-falsy one of the
previous branches will be taken, so we can just check that any of the
image fields is present at all (this implies it's falsy).
2017-12-05 13:35:51 +01:00
Andrew Latham b67e18bcb5 [IMP] tools: basic spelling and grammar corrections
Closes #20391
2017-10-25 09:22:52 +02:00
Christophe Simonis c5f680200c [MERGE] forward port branch saas-17 up to d08b4407be 2017-09-12 12:09:11 +02:00
Xavier Morel 6bb6944e6b [FIX] P3: resizing of image *fields*
Fields sent from the client are pretty much always *text*. This can be
problematic for image fields sent as base64 *text* as in Python 3 the
base64 routines only work between bytes.

Alter the core field-resizing function (image_get_resized_images) such
that it ensures text base64 sources are encoded back to bytes before
being forwarded to the main resizing routines (which I don't think
should deal with *that* issue).

Fixes #18985: error when trying to update a company's logo
2017-09-07 10:47:02 +02:00
Yannick Tivisse f49683bc0f [IMP] image.py: Make 6801baa work in python3 2017-09-05 16:31:47 +02:00
Yannick Tivisse 6801baa662 [IMP] image.py: Crop image with maximum size instead of ratio
Purpose
=======

It makes no sense to crop an image from a ration. We don't say "I don't know my image size, but divide it by 2"

Specification
=============

Pass a maximum size argument instead of a thumbnail ratio
2017-09-05 15:52:15 +02:00
Xavier Morel 3824b5dcc1 [FIX] P3: fix base64 and StringIO uses
* StringIO removed from stdlib, replace with io
* try to correctly handle BytesIO/StringIO (one is for bytes the other
  is for text)
* fix base64: Python 3 removed bytes-encoding and bytes-bytes
  codecs (via #encode) so replace all calls to str.encode('base64'),
  also b64encode is a bytes->bytes conversion so attempt to properly
  handle that

issue #8530
2017-08-20 23:25:54 +02:00
Xavier Morel 25df2352f5 [FIX] P3: / has become 'real division' in all cases 2017-08-19 02:34:22 +02:00
Christophe Simonis bf51fe55a1 [MERGE] forward port branch saas-16 up to 0f2b2c4e2b 2017-07-07 14:30:30 +02:00
Christophe Simonis 0f2b2c4e2b [MERGE] forward port branch saas-15 up to 514a1a76d8 2017-07-07 14:18:07 +02:00
Christophe Simonis aef7748845 [MERGE] forward port branch saas-11 up to 96fa86779b 2017-07-07 14:07:47 +02:00
Xavier Morel e5ef1c5917 [FIX] P3: don't resize the value False
Yields really strange errors in P3.
2017-05-22 13:30:50 +02:00
Olivier Dony 5afe894f44 [MERGE] Forward-port saas-15 up to 878fbc75ff 2017-05-16 17:09:45 +02:00
Olivier Dony 8fbbe04a50 [FIX] tools: always preload PIL with basic formats
Ensures that only the desired list of images formats are made available
via PIL: BMP, GIF, PNG, JPEG, TIFF and PPM.
2017-05-05 17:02:45 +02:00
xmo-odoo 2e6a589f41 [FIX] builtins removed from Python 3
* Reverse wrapper courtesy of @rco-odoo's original P3 branch
* thin compat module stripped down from werkzeug (to augment as needed)

issue 8530
2017-04-27 13:59:33 +02:00
Christophe Simonis 6804085b8c [MERGE] forward port branch saas-11 up to b9374d5c21 2017-01-23 13:56:18 +01:00
Raphael Collet 9e64f9f951 [REF] openerp: move openerp to odoo 2016-09-02 17:28:12 +02:00