Prompt users to migrate base64 images to mediatags in the pad app

This commit is contained in:
yflory
2018-08-29 18:20:34 +02:00
parent b1f2d287b4
commit 90c96bfb70
5 changed files with 154 additions and 3 deletions

View File

@@ -154,6 +154,22 @@ define([], function () {
xhr.send(null);
};
Util.dataURIToBlob = function (dataURI) {
var byteString = atob(dataURI.split(',')[1]);
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
// write the bytes of the string to an ArrayBuffer
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
// write the ArrayBuffer to a blob, and you're done
var bb = new Blob([ab], {type: mimeString});
return bb;
};
Util.throttle = function (f, ms) {
var to;
var g = function () {