Move `blueimp-canvas-to-blob` from Bower to npm

This commit is contained in:
Daniel Gasienica 2018-02-12 20:12:50 -05:00
parent 7ccb833e5d
commit 141155a153
6 changed files with 10 additions and 12 deletions

View File

@ -15,7 +15,6 @@
"indexeddb-backbonejs-adapter": "*",
"intl-tel-input": "~4.0.1",
"blueimp-load-image": "~1.13.0",
"blueimp-canvas-to-blob": "~2.1.1",
"autosize": "~4.0.0",
"webaudiorecorder": "https://github.com/higuma/web-audio-recorder-js.git",
"mp3lameencoder": "https://github.com/higuma/mp3-lame-encoder-js.git",
@ -69,9 +68,6 @@
"build/img/flags.png",
"build/js/intlTelInput.js"
],
"blueimp-canvas-to-blob": [
"js/canvas-to-blob.js"
],
"emojijs": [
"lib/emoji.js",
"demo/emoji.css"
@ -110,7 +106,6 @@
"moment",
"intl-tel-input",
"backbone.typeahead",
"blueimp-canvas-to-blob",
"autosize",
"filesize"
],

View File

@ -1,6 +1,6 @@
/* jshint ignore:start */
const {autoOrientImage} = require('../auto_orient_image');
const dataURLToBlob = require('blueimp-canvas-to-blob');
// // Fields
// {
@ -46,7 +46,7 @@ const autoOrientJPEGs = async attachment => {
}
const dataBlob = arrayBufferToBlob(attachment.data, attachment.contentType);
const newDataBlob = dataURLtoBlob(await autoOrientImage(dataBlob));
const newDataBlob = dataURLToBlob(await autoOrientImage(dataBlob));
const newDataArrayBuffer = await blobToArrayBuffer(newDataBlob);
const newAttachment = Object.assign({}, attachment, {
data: newDataArrayBuffer,

View File

@ -93,7 +93,6 @@
return;
}
// loadImage.scale -> components/blueimp-load-image
var canvas = loadImage.scale(img, {
canvas: true, maxWidth: maxWidth, maxHeight: maxHeight
});
@ -103,10 +102,9 @@
var blob;
do {
i = i - 1;
// dataURLtoBlob -> components/blueimp-canvas-to-blob
// TODO: Replace with native `Canvas::toBlob`:
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob
blob = dataURLtoBlob(
blob = window.dataURLToBlob(
canvas.toDataURL('image/jpeg', quality)
);
quality = quality * maxSize / blob.size;
@ -230,10 +228,9 @@
crop: true, minWidth: size, minHeight: size
});
// dataURLtoBlob -> components/blueimp-canvas-to-blob
// TODO: Replace with native `Canvas::toBlob`:
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob
var blob = dataURLtoBlob(canvas.toDataURL('image/png'));
var blob = window.dataURLToBlob(canvas.toDataURL('image/png'));
resolve(blob);
};

View File

@ -41,6 +41,7 @@
"open-coverage": "open coverage/lcov-report/index.html"
},
"dependencies": {
"blueimp-canvas-to-blob": "^3.14.0",
"blueimp-load-image": "^2.18.0",
"bunyan": "^1.8.12",
"config": "^1.28.1",

View File

@ -60,6 +60,7 @@
window.nodeSetImmediate(function() {});
}, 1000);
window.dataURLToBlob = require('blueimp-canvas-to-blob');
window.ProxyAgent = require('proxy-agent');
window.EmojiConvertor = require('emoji-js');
window.emojiData = require('emoji-datasource');

View File

@ -457,6 +457,10 @@ bluebird@^3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9"
blueimp-canvas-to-blob@^3.14.0:
version "3.14.0"
resolved "https://registry.yarnpkg.com/blueimp-canvas-to-blob/-/blueimp-canvas-to-blob-3.14.0.tgz#ea075ffbfb1436607b0c75e951fb1ceb3ca0288e"
blueimp-load-image@^2.18.0:
version "2.18.0"
resolved "https://registry.yarnpkg.com/blueimp-load-image/-/blueimp-load-image-2.18.0.tgz#03b93687eb382a7136cfbcbd4f0e936b6763fc0e"