[FIX] website: correct image resizing
This commit is contained in:
parent
7d7f6fefb1
commit
f2cb8702b2
|
@ -399,10 +399,15 @@ class Website(openerp.addons.web.controllers.main.Home):
|
||||||
The requested field is assumed to be base64-encoded image data in
|
The requested field is assumed to be base64-encoded image data in
|
||||||
all cases.
|
all cases.
|
||||||
"""
|
"""
|
||||||
response = werkzeug.wrappers.Response()
|
try:
|
||||||
return request.registry['website']._image(
|
response = werkzeug.wrappers.Response()
|
||||||
request.cr, request.uid, model, id, field, response, max_width, max_height)
|
return request.registry['website']._image(
|
||||||
|
request.cr, request.uid, model, id, field, response, max_width, max_height)
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Cannot render image field %r of record %s[%s] at size(%s,%s)",
|
||||||
|
field, model, id, max_width, max_height)
|
||||||
|
response = werkzeug.wrappers.Response()
|
||||||
|
return self.placeholder(response)
|
||||||
|
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
# Server actions
|
# Server actions
|
||||||
|
|
|
@ -554,10 +554,8 @@ class website(osv.osv):
|
||||||
response.mimetype = Image.MIME[image.format]
|
response.mimetype = Image.MIME[image.format]
|
||||||
|
|
||||||
w, h = image.size
|
w, h = image.size
|
||||||
try:
|
max_w = int(max_width) if max_width else maxint
|
||||||
max_w, max_h = int(max_width), int(max_height)
|
max_h = int(max_height) if max_height else maxint
|
||||||
except:
|
|
||||||
max_w, max_h = (maxint, maxint)
|
|
||||||
|
|
||||||
if w < max_w and h < max_h:
|
if w < max_w and h < max_h:
|
||||||
response.data = data
|
response.data = data
|
||||||
|
|
Loading…
Reference in New Issue