forked from Techsystech/web
[web_tree_image] Add support resize option
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)9.0
parent
fa199590b3
commit
09feead204
|
@ -35,7 +35,15 @@ openerp.web_tree_image = function (instance) {
|
||||||
// The media subtype (png) seems to be arbitrary
|
// The media subtype (png) seems to be arbitrary
|
||||||
src = "data:image/png;base64," + value;
|
src = "data:image/png;base64," + value;
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
if (!/\//.test(row_data[this.id].value)) {
|
if (!/\//.test(row_data[this.id].value)) {
|
||||||
|
|
Loading…
Reference in New Issue