mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] Remove extra padding from Image binary
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
"category": "web",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"author": "Tech Receptives, "
|
||||
"Odoo Community Association (OCA), "
|
||||
"Kaushal Prajapati",
|
||||
"Kaushal Prajapati, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"license": "LGPL-3",
|
||||
"data": [
|
||||
"views/assets.xml",
|
||||
|
||||
@@ -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.
|
||||
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
|
||||
self.on_file_uploaded(approx_img_size, "web-cam-preview.jpeg", "image/jpeg", img_data_base64);
|
||||
|
||||
Reference in New Issue
Block a user