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

View File

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

View File

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

View File

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

View File

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

View File

@@ -457,6 +457,10 @@ bluebird@^3.5.1:
version "3.5.1" version "3.5.1"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" 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: blueimp-load-image@^2.18.0:
version "2.18.0" version "2.18.0"
resolved "https://registry.yarnpkg.com/blueimp-load-image/-/blueimp-load-image-2.18.0.tgz#03b93687eb382a7136cfbcbd4f0e936b6763fc0e" resolved "https://registry.yarnpkg.com/blueimp-load-image/-/blueimp-load-image-2.18.0.tgz#03b93687eb382a7136cfbcbd4f0e936b6763fc0e"