@uppy/thumbnail-generator
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -7,4 +7,2 @@ var _class, _temp; | ||
var Exif = require('exif-js'); | ||
var _require = require('@uppy/core'), | ||
@@ -22,2 +20,4 @@ Plugin = _require.Plugin; | ||
var ORIENTATIONS = require('./image-orientations'); | ||
var Exif = require('./exif'); | ||
/** | ||
@@ -82,8 +82,19 @@ * The Thumbnail Generator plugin | ||
}); | ||
var emitPreprocessCompleteForAll = function emitPreprocessCompleteForAll() { | ||
fileIDs.forEach(function (fileID) { | ||
var file = _this.uppy.getFile(fileID); | ||
_this.uppy.emit('preprocess-complete', file); | ||
}); | ||
}; | ||
return new Promise(function (resolve, reject) { | ||
if (_this.queueProcessing) { | ||
_this.uppy.once('thumbnail:all-generated', function () { | ||
emitPreprocessCompleteForAll(); | ||
resolve(); | ||
}); | ||
} else { | ||
emitPreprocessCompleteForAll(); | ||
resolve(); | ||
@@ -134,3 +145,4 @@ } | ||
* @param {{data: Blob}} file | ||
* @param {number} width | ||
* @param {number} targetWidth | ||
* @param {number} targetHeight | ||
* @returns {Promise} | ||
@@ -212,8 +224,4 @@ */ | ||
Exif.getData(file.data, function exifGetDataCallback() { | ||
var exifdata = Exif.getAllTags(this); // delete the thumbnail from exif metadata, because it contains a blob | ||
// and we don’t blobs in meta — it might lead to unexpected issues on the server | ||
delete exifdata.thumbnail; | ||
uppy.setFileMeta(file.id, { | ||
exifdata: exifdata | ||
exifdata: Exif.getAllTags(this) | ||
}); | ||
@@ -435,2 +443,2 @@ var orientation = Exif.getTag(this, 'Orientation') || 1; | ||
return ThumbnailGenerator; | ||
}(Plugin), _class.VERSION = "1.5.0", _temp); | ||
}(Plugin), _class.VERSION = "1.5.1", _temp); |
{ | ||
"name": "@uppy/thumbnail-generator", | ||
"description": "Uppy plugin that generates small previews of images to show on your upload UI.", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"license": "MIT", | ||
@@ -25,4 +25,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/utils": "^2.1.0", | ||
"exif-js": "2.3.0" | ||
"@uppy/utils": "^2.1.1" | ||
}, | ||
@@ -32,3 +31,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "c370dba0b6d48770995d0c764bb54f0b05309781" | ||
"gitHead": "18180d577854d1a78588d67eb210528b207bf130" | ||
} |
@@ -1,2 +0,1 @@ | ||
const Exif = require('exif-js') | ||
const { Plugin } = require('@uppy/core') | ||
@@ -8,2 +7,3 @@ const Translator = require('@uppy/utils/lib/Translator') | ||
const ORIENTATIONS = require('./image-orientations') | ||
const Exif = require('./exif') | ||
@@ -58,3 +58,4 @@ /** | ||
* @param {{data: Blob}} file | ||
* @param {number} width | ||
* @param {number} targetWidth | ||
* @param {number} targetHeight | ||
* @returns {Promise} | ||
@@ -128,7 +129,3 @@ */ | ||
Exif.getData(file.data, function exifGetDataCallback () { | ||
const exifdata = Exif.getAllTags(this) | ||
// delete the thumbnail from exif metadata, because it contains a blob | ||
// and we don’t blobs in meta — it might lead to unexpected issues on the server | ||
delete exifdata.thumbnail | ||
uppy.setFileMeta(file.id, { exifdata }) | ||
uppy.setFileMeta(file.id, { exifdata: Exif.getAllTags(this) }) | ||
const orientation = Exif.getTag(this, 'Orientation') || 1 | ||
@@ -350,8 +347,17 @@ resolve(ORIENTATIONS[orientation]) | ||
const emitPreprocessCompleteForAll = () => { | ||
fileIDs.forEach((fileID) => { | ||
const file = this.uppy.getFile(fileID) | ||
this.uppy.emit('preprocess-complete', file) | ||
}) | ||
} | ||
return new Promise((resolve, reject) => { | ||
if (this.queueProcessing) { | ||
this.uppy.once('thumbnail:all-generated', () => { | ||
emitPreprocessCompleteForAll() | ||
resolve() | ||
}) | ||
} else { | ||
emitPreprocessCompleteForAll() | ||
resolve() | ||
@@ -358,0 +364,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84696
2
14
2472
- Removedexif-js@2.3.0
- Removedexif-js@2.3.0(transitive)
Updated@uppy/utils@^2.1.1