[IMP] Remove extra padding from Image binary.

pull/2323/head
Siddharth Bhalgami 2019-11-01 18:04:28 +08:00 committed by Sylvain LE GAL
parent b842bea6f6
commit e2cb83d312
2 changed files with 3 additions and 3 deletions

View File

@ -7,8 +7,8 @@
"category": "web", "category": "web",
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",
"author": "Tech Receptives, " "author": "Tech Receptives, "
"Odoo Community Association (OCA), " "Kaushal Prajapati, "
"Kaushal Prajapati", "Odoo Community Association (OCA)",
"license": "LGPL-3", "license": "LGPL-3",
"data": [ "data": [
"views/assets.xml", "views/assets.xml",

View File

@ -91,7 +91,7 @@ odoo.define('web_widget_image_webcam.webcam_widget', function(require) {
*/ */
// From the above info, we doing the opposite stuff to find the approx size of Image in bytes. // From the above info, we doing the opposite stuff to find the approx size of Image in bytes.
var approx_img_size = 3 * (img_data_base64.length / 4) // like... "3[n/4]" var approx_img_size = 3 * (img_data_base64.length / 4) - (img_data_base64.match(/=+$/g) || []).length; // like... "3[n/4]"
// Upload image in Binary Field // Upload image in Binary Field
self.on_file_uploaded(approx_img_size, "web-cam-preview.jpeg", "image/jpeg", img_data_base64); self.on_file_uploaded(approx_img_size, "web-cam-preview.jpeg", "image/jpeg", img_data_base64);