mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 00:15:46 +01:00
closes #6722
calculate size of base64 image from buffer, still not perfect but better than string.length
This commit is contained in:
@@ -125,3 +125,7 @@ image.writeImageDataToTempFile = function (imageData, callback) {
|
||||
callback(err, filepath);
|
||||
});
|
||||
};
|
||||
|
||||
image.sizeFromBase64 = function (imageData) {
|
||||
return Buffer.from(imageData.slice(imageData.indexOf('base64') + 7), 'base64').length;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user