Skip to content

Commit

Permalink
[web_tree_image] Add support resize option
Browse files Browse the repository at this point in the history
set resize="<width>,<height>" in the field tag definition to
make the server return a resized version of the image.
Useful for saving bandwidth when dealing with large images and to
have uniform image sizes (aspect ratio is mantained by filling
emtpy areas with transparent background)
  • Loading branch information
LeartS committed Oct 9, 2015
1 parent fa19959 commit 09feead
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web_tree_image/static/src/js/web_tree_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ openerp.web_tree_image = function (instance) {
// The media subtype (png) seems to be arbitrary
src = "data:image/png;base64," + value;
} else {
src = instance.session.url('/web/binary/image', {model: options.model, field: this.id, id: options.id});
var imageArgs = {
model: options.model,
field: this.id,
id: options.id
}
if (this.resize) {
imageArgs.resize = this.resize;
}
src = instance.session.url('/web/binary/image', imageArgs);
}
} else {
if (!/\//.test(row_data[this.id].value)) {
Expand Down

0 comments on commit 09feead

Please sign in to comment.