@webex/helper-image 3.0.0-beta.15 → 3.0.0-beta.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/detect-filetype.js +3 -12
- package/dist/detect-filetype.js.map +1 -1
- package/dist/index.js +36 -73
- package/dist/index.js.map +1 -1
- package/dist/process-image.browser.js +13 -34
- package/dist/process-image.browser.js.map +1 -1
- package/dist/process-image.js +5 -23
- package/dist/process-image.js.map +1 -1
- package/package.json +6 -6
package/dist/detect-filetype.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = detectFileType;
|
|
12
|
-
|
|
13
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
14
|
-
|
|
15
10
|
var _httpCore = require("@webex/http-core");
|
|
16
|
-
|
|
17
11
|
var _mime = require("mime");
|
|
18
|
-
|
|
19
12
|
/*!
|
|
20
13
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
21
14
|
*/
|
|
@@ -31,20 +24,18 @@ function detectFileType(file, logger) {
|
|
|
31
24
|
logger.info("file already has type ".concat(file.type, ". using existing file.type."));
|
|
32
25
|
return _promise.default.resolve(file.type);
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
if (file.mimeType) {
|
|
36
28
|
logger.info("file already has mimeType ".concat(file.type, ". using existing file.mimeType."));
|
|
37
29
|
return _promise.default.resolve(file.mimeType);
|
|
38
|
-
}
|
|
39
|
-
// buffers are expected to have names there, it'll stay here for now.
|
|
40
|
-
|
|
30
|
+
}
|
|
41
31
|
|
|
32
|
+
// This kinda belongs in http core, but since we have no guarantee that
|
|
33
|
+
// buffers are expected to have names there, it'll stay here for now.
|
|
42
34
|
return (0, _httpCore.detect)(file).then(function (type) {
|
|
43
35
|
if (type === 'application/x-msi' || type === 'application/octet-stream') {
|
|
44
36
|
logger.info("detected filetype to be ".concat(type, ". Falling back to mime.lookup"));
|
|
45
37
|
return (0, _mime.getType)(file.name);
|
|
46
38
|
}
|
|
47
|
-
|
|
48
39
|
logger.info("detected filetype to be ".concat(type, ". returning it"));
|
|
49
40
|
return type;
|
|
50
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["detectFileType","file","logger","type","info","resolve","mimeType","detect","then","getType","name"],"sources":["detect-filetype.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {detect} from '@webex/http-core';\nimport {getType} from 'mime';\n\n/**\n * Determines the file type of the specified file\n * @param {FileLike} file\n * @param {Object} logger\n * @returns {Promise<string>}\n */\nexport default function detectFileType(file, logger) {\n if (file.type) {\n logger.info(`file already has type ${file.type}. using existing file.type.`);\n\n return Promise.resolve(file.type);\n }\n\n if (file.mimeType) {\n logger.info(`file already has mimeType ${file.type}. using existing file.mimeType.`);\n\n return Promise.resolve(file.mimeType);\n }\n\n // This kinda belongs in http core, but since we have no guarantee that\n // buffers are expected to have names there, it'll stay here for now.\n return detect(file).then((type) => {\n if (type === 'application/x-msi' || type === 'application/octet-stream') {\n logger.info(`detected filetype to be ${type}. Falling back to mime.lookup`);\n\n return getType(file.name);\n }\n\n logger.info(`detected filetype to be ${type}. returning it`);\n\n return type;\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["detectFileType","file","logger","type","info","resolve","mimeType","detect","then","getType","name"],"sources":["detect-filetype.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {detect} from '@webex/http-core';\nimport {getType} from 'mime';\n\n/**\n * Determines the file type of the specified file\n * @param {FileLike} file\n * @param {Object} logger\n * @returns {Promise<string>}\n */\nexport default function detectFileType(file, logger) {\n if (file.type) {\n logger.info(`file already has type ${file.type}. using existing file.type.`);\n\n return Promise.resolve(file.type);\n }\n\n if (file.mimeType) {\n logger.info(`file already has mimeType ${file.type}. using existing file.mimeType.`);\n\n return Promise.resolve(file.mimeType);\n }\n\n // This kinda belongs in http core, but since we have no guarantee that\n // buffers are expected to have names there, it'll stay here for now.\n return detect(file).then((type) => {\n if (type === 'application/x-msi' || type === 'application/octet-stream') {\n logger.info(`detected filetype to be ${type}. Falling back to mime.lookup`);\n\n return getType(file.name);\n }\n\n logger.info(`detected filetype to be ${type}. returning it`);\n\n return type;\n });\n}\n"],"mappings":";;;;;;;;;AAIA;AACA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAc,CAACC,IAAI,EAAEC,MAAM,EAAE;EACnD,IAAID,IAAI,CAACE,IAAI,EAAE;IACbD,MAAM,CAACE,IAAI,iCAA0BH,IAAI,CAACE,IAAI,iCAA8B;IAE5E,OAAO,iBAAQE,OAAO,CAACJ,IAAI,CAACE,IAAI,CAAC;EACnC;EAEA,IAAIF,IAAI,CAACK,QAAQ,EAAE;IACjBJ,MAAM,CAACE,IAAI,qCAA8BH,IAAI,CAACE,IAAI,qCAAkC;IAEpF,OAAO,iBAAQE,OAAO,CAACJ,IAAI,CAACK,QAAQ,CAAC;EACvC;;EAEA;EACA;EACA,OAAO,IAAAC,gBAAM,EAACN,IAAI,CAAC,CAACO,IAAI,CAAC,UAACL,IAAI,EAAK;IACjC,IAAIA,IAAI,KAAK,mBAAmB,IAAIA,IAAI,KAAK,0BAA0B,EAAE;MACvED,MAAM,CAACE,IAAI,mCAA4BD,IAAI,mCAAgC;MAE3E,OAAO,IAAAM,aAAO,EAACR,IAAI,CAACS,IAAI,CAAC;IAC3B;IAEAR,MAAM,CAACE,IAAI,mCAA4BD,IAAI,oBAAiB;IAE5D,OAAOA,IAAI;EACb,CAAC,CAAC;AACJ"}
|
package/dist/index.js
CHANGED
|
@@ -1,53 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
_Object$defineProperty(exports, "detectFileType", {
|
|
12
9
|
enumerable: true,
|
|
13
10
|
get: function get() {
|
|
14
11
|
return _detectFiletype.default;
|
|
15
12
|
}
|
|
16
13
|
});
|
|
17
|
-
|
|
18
14
|
exports.orient = orient;
|
|
19
|
-
|
|
20
15
|
_Object$defineProperty(exports, "processImage", {
|
|
21
16
|
enumerable: true,
|
|
22
17
|
get: function get() {
|
|
23
18
|
return _processImage.default;
|
|
24
19
|
}
|
|
25
20
|
});
|
|
26
|
-
|
|
27
21
|
exports.readExifData = readExifData;
|
|
28
22
|
exports.updateImageOrientation = updateImageOrientation;
|
|
29
|
-
|
|
30
23
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
31
|
-
|
|
32
24
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
33
|
-
|
|
34
25
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
35
|
-
|
|
36
26
|
var _processImage = _interopRequireDefault(require("./process-image"));
|
|
37
|
-
|
|
38
27
|
var _detectFiletype = _interopRequireDefault(require("./detect-filetype"));
|
|
39
|
-
|
|
40
28
|
/*!
|
|
41
29
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
42
30
|
*/
|
|
43
31
|
|
|
44
32
|
/* eslint no-unused-vars: ["error", { "vars": "local" }] */
|
|
45
33
|
// eslint-disable-next-line no-redeclare
|
|
46
|
-
var _require = require('safe-buffer'),
|
|
47
|
-
Buffer = _require.Buffer;
|
|
48
34
|
|
|
35
|
+
var _require = require('safe-buffer'),
|
|
36
|
+
Buffer = _require.Buffer;
|
|
49
37
|
var _require2 = require('exifr/dist/lite.umd'),
|
|
50
|
-
|
|
38
|
+
parse = _require2.parse;
|
|
39
|
+
|
|
51
40
|
/**
|
|
52
41
|
* Updates the image file with exif information, required to correctly rotate the image activity
|
|
53
42
|
* @param {Object} file
|
|
@@ -55,14 +44,11 @@ var _require2 = require('exifr/dist/lite.umd'),
|
|
|
55
44
|
* @param {boolean} options.shouldNotAddExifData
|
|
56
45
|
* @returns {Promise<Object>}
|
|
57
46
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
47
|
function updateImageOrientation(file) {
|
|
61
48
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
62
49
|
return new _promise.default(function (resolve) {
|
|
63
50
|
var reader = new FileReader();
|
|
64
51
|
reader.readAsArrayBuffer(file);
|
|
65
|
-
|
|
66
52
|
reader.onload = function onload() {
|
|
67
53
|
var arrayBuffer = reader.result;
|
|
68
54
|
var buf = Buffer.from(arrayBuffer);
|
|
@@ -72,84 +58,69 @@ function updateImageOrientation(file) {
|
|
|
72
58
|
if (options.shouldNotAddExifData) {
|
|
73
59
|
return buf;
|
|
74
60
|
}
|
|
75
|
-
|
|
76
61
|
return readExifData(file, buf);
|
|
77
62
|
});
|
|
78
63
|
}
|
|
64
|
+
|
|
79
65
|
/**
|
|
80
66
|
* Adds exif orientation information on the image file
|
|
81
67
|
* @param {Object} file
|
|
82
68
|
* @param {Object} buf
|
|
83
69
|
* @returns {Promise<ExifImage>}
|
|
84
70
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
71
|
function readExifData(_x, _x2) {
|
|
88
72
|
return _readExifData.apply(this, arguments);
|
|
89
73
|
}
|
|
90
74
|
/* eslint-disable complexity */
|
|
91
|
-
|
|
92
75
|
/**
|
|
93
76
|
* Rotates/flips the image on the canvas as per exif information
|
|
94
77
|
* @param {Object} options(orientation: image exif orientation range from 1-8, img: Image object, x: start x-axis, y: start y-axis, width: width of the thumbnail, height: height of the thumbnail, ctx: canvas context)
|
|
95
78
|
* @param {Object} file
|
|
96
79
|
* @returns {Object}
|
|
97
80
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
81
|
function _readExifData() {
|
|
101
82
|
_readExifData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(file, buf) {
|
|
102
83
|
var exifData, Orientation, ExifImageHeight, ExifImageWidth;
|
|
103
84
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
104
|
-
while (1) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
85
|
+
while (1) switch (_context.prev = _context.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
if (!(file && (file.type === 'image/jpeg' || file.mimeType === 'image/jpeg'))) {
|
|
88
|
+
_context.next = 5;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
_context.next = 3;
|
|
92
|
+
return parse(buf, {
|
|
93
|
+
translateValues: false
|
|
94
|
+
});
|
|
95
|
+
case 3:
|
|
96
|
+
exifData = _context.sent;
|
|
97
|
+
if (exifData) {
|
|
98
|
+
Orientation = exifData.Orientation, ExifImageHeight = exifData.ExifImageHeight, ExifImageWidth = exifData.ExifImageWidth;
|
|
99
|
+
file.orientation = Orientation;
|
|
100
|
+
file.exifHeight = ExifImageHeight;
|
|
101
|
+
file.exifWidth = ExifImageWidth;
|
|
102
|
+
if (file.image) {
|
|
103
|
+
file.image.orientation = Orientation;
|
|
110
104
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
case 3:
|
|
118
|
-
exifData = _context.sent;
|
|
119
|
-
|
|
120
|
-
if (exifData) {
|
|
121
|
-
Orientation = exifData.Orientation, ExifImageHeight = exifData.ExifImageHeight, ExifImageWidth = exifData.ExifImageWidth;
|
|
122
|
-
file.orientation = Orientation;
|
|
123
|
-
file.exifHeight = ExifImageHeight;
|
|
124
|
-
file.exifWidth = ExifImageWidth;
|
|
125
|
-
|
|
126
|
-
if (file.image) {
|
|
127
|
-
file.image.orientation = Orientation;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
case 5:
|
|
132
|
-
return _context.abrupt("return", buf);
|
|
133
|
-
|
|
134
|
-
case 6:
|
|
135
|
-
case "end":
|
|
136
|
-
return _context.stop();
|
|
137
|
-
}
|
|
105
|
+
}
|
|
106
|
+
case 5:
|
|
107
|
+
return _context.abrupt("return", buf);
|
|
108
|
+
case 6:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context.stop();
|
|
138
111
|
}
|
|
139
112
|
}, _callee);
|
|
140
113
|
}));
|
|
141
114
|
return _readExifData.apply(this, arguments);
|
|
142
115
|
}
|
|
143
|
-
|
|
144
116
|
function orient(options, file) {
|
|
145
117
|
var width = options.width,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
118
|
+
height = options.height,
|
|
119
|
+
ctx = options.ctx,
|
|
120
|
+
img = options.img,
|
|
121
|
+
orientation = options.orientation,
|
|
122
|
+
x = options.x,
|
|
123
|
+
y = options.y;
|
|
153
124
|
if (file && file.orientation && file.orientation !== 1) {
|
|
154
125
|
// explanation of orientation:
|
|
155
126
|
// https://stackoverflow.com/questions/20600800/js-client-side-exif-orientation-rotate-and-mirror-jpeg-images
|
|
@@ -158,42 +129,34 @@ function orient(options, file) {
|
|
|
158
129
|
// flip
|
|
159
130
|
ctx.transform(-1, 0, 0, 1, width, 0);
|
|
160
131
|
break;
|
|
161
|
-
|
|
162
132
|
case 3:
|
|
163
133
|
// rotateImage180
|
|
164
134
|
ctx.transform(-1, 0, 0, -1, width, height);
|
|
165
135
|
break;
|
|
166
|
-
|
|
167
136
|
case 4:
|
|
168
137
|
// rotate180AndFlipImage
|
|
169
138
|
ctx.transform(1, 0, 0, -1, 0, height);
|
|
170
139
|
break;
|
|
171
|
-
|
|
172
140
|
case 5:
|
|
173
141
|
// rotate90AndFlipImage
|
|
174
142
|
ctx.transform(0, 1, 1, 0, 0, 0);
|
|
175
143
|
break;
|
|
176
|
-
|
|
177
144
|
case 6:
|
|
178
145
|
// rotateImage90
|
|
179
146
|
ctx.transform(0, 1, -1, 0, height, 0);
|
|
180
147
|
break;
|
|
181
|
-
|
|
182
148
|
case 7:
|
|
183
149
|
// rotateNeg90AndFlipImage
|
|
184
150
|
ctx.transform(0, -1, -1, 0, height, width);
|
|
185
151
|
break;
|
|
186
|
-
|
|
187
152
|
case 8:
|
|
188
153
|
// rotateNeg90
|
|
189
154
|
ctx.transform(0, -1, 1, 0, 0, width);
|
|
190
155
|
break;
|
|
191
|
-
|
|
192
156
|
default:
|
|
193
157
|
break;
|
|
194
158
|
}
|
|
195
159
|
}
|
|
196
|
-
|
|
197
160
|
ctx.drawImage(img, x, y, width, height);
|
|
198
161
|
}
|
|
199
162
|
/* eslint-enable complexity */
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","Buffer","parse","updateImageOrientation","file","options","resolve","reader","FileReader","readAsArrayBuffer","onload","arrayBuffer","result","buf","from","then","shouldNotAddExifData","readExifData","type","mimeType","translateValues","exifData","Orientation","ExifImageHeight","ExifImageWidth","orientation","exifHeight","exifWidth","image","orient","width","height","ctx","img","x","y","transform","drawImage"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint no-unused-vars: [\"error\", { \"vars\": \"local\" }] */\n// eslint-disable-next-line no-redeclare\n\nconst {Buffer} = require('safe-buffer');\nconst {parse} = require('exifr/dist/lite.umd');\n\n/**\n * Updates the image file with exif information, required to correctly rotate the image activity\n * @param {Object} file\n * @param {Object} options\n * @param {boolean} options.shouldNotAddExifData\n * @returns {Promise<Object>}\n */\nexport function updateImageOrientation(file, options = {}) {\n return new Promise((resolve) => {\n const reader = new FileReader();\n\n reader.readAsArrayBuffer(file);\n reader.onload = function onload() {\n const arrayBuffer = reader.result;\n const buf = Buffer.from(arrayBuffer);\n\n resolve(buf);\n };\n }).then((buf) => {\n if (options.shouldNotAddExifData) {\n return buf;\n }\n\n return readExifData(file, buf);\n });\n}\n\n/**\n * Adds exif orientation information on the image file\n * @param {Object} file\n * @param {Object} buf\n * @returns {Promise<ExifImage>}\n */\nexport async function readExifData(file, buf) {\n // For avatar images the file.type is set as image/jpeg, however for images shared in an activity file.mimeType is set as image/jpeg. Handling both conditions.\n if (file && (file.type === 'image/jpeg' || file.mimeType === 'image/jpeg')) {\n const exifData = await parse(buf, {translateValues: false});\n\n if (exifData) {\n const {Orientation, ExifImageHeight, ExifImageWidth} = exifData;\n\n file.orientation = Orientation;\n file.exifHeight = ExifImageHeight;\n file.exifWidth = ExifImageWidth;\n\n if (file.image) {\n file.image.orientation = Orientation;\n }\n }\n }\n\n return buf;\n}\n\n/* eslint-disable complexity */\n/**\n * Rotates/flips the image on the canvas as per exif information\n * @param {Object} options(orientation: image exif orientation range from 1-8, img: Image object, x: start x-axis, y: start y-axis, width: width of the thumbnail, height: height of the thumbnail, ctx: canvas context)\n * @param {Object} file\n * @returns {Object}\n */\nexport function orient(options, file) {\n const {width, height, ctx, img, orientation, x, y} = options;\n\n if (file && file.orientation && file.orientation !== 1) {\n // explanation of orientation:\n // https://stackoverflow.com/questions/20600800/js-client-side-exif-orientation-rotate-and-mirror-jpeg-images\n switch (orientation) {\n case 2:\n // flip\n ctx.transform(-1, 0, 0, 1, width, 0);\n break;\n case 3:\n // rotateImage180\n ctx.transform(-1, 0, 0, -1, width, height);\n break;\n case 4:\n // rotate180AndFlipImage\n ctx.transform(1, 0, 0, -1, 0, height);\n break;\n case 5:\n // rotate90AndFlipImage\n ctx.transform(0, 1, 1, 0, 0, 0);\n break;\n case 6:\n // rotateImage90\n ctx.transform(0, 1, -1, 0, height, 0);\n break;\n case 7:\n // rotateNeg90AndFlipImage\n ctx.transform(0, -1, -1, 0, height, width);\n break;\n case 8:\n // rotateNeg90\n ctx.transform(0, -1, 1, 0, 0, width);\n break;\n default:\n break;\n }\n }\n ctx.drawImage(img, x, y, width, height);\n}\n/* eslint-enable complexity */\n\nexport {default as processImage} from './process-image';\nexport {default as detectFileType} from './detect-filetype';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["require","Buffer","parse","updateImageOrientation","file","options","resolve","reader","FileReader","readAsArrayBuffer","onload","arrayBuffer","result","buf","from","then","shouldNotAddExifData","readExifData","type","mimeType","translateValues","exifData","Orientation","ExifImageHeight","ExifImageWidth","orientation","exifHeight","exifWidth","image","orient","width","height","ctx","img","x","y","transform","drawImage"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint no-unused-vars: [\"error\", { \"vars\": \"local\" }] */\n// eslint-disable-next-line no-redeclare\n\nconst {Buffer} = require('safe-buffer');\nconst {parse} = require('exifr/dist/lite.umd');\n\n/**\n * Updates the image file with exif information, required to correctly rotate the image activity\n * @param {Object} file\n * @param {Object} options\n * @param {boolean} options.shouldNotAddExifData\n * @returns {Promise<Object>}\n */\nexport function updateImageOrientation(file, options = {}) {\n return new Promise((resolve) => {\n const reader = new FileReader();\n\n reader.readAsArrayBuffer(file);\n reader.onload = function onload() {\n const arrayBuffer = reader.result;\n const buf = Buffer.from(arrayBuffer);\n\n resolve(buf);\n };\n }).then((buf) => {\n if (options.shouldNotAddExifData) {\n return buf;\n }\n\n return readExifData(file, buf);\n });\n}\n\n/**\n * Adds exif orientation information on the image file\n * @param {Object} file\n * @param {Object} buf\n * @returns {Promise<ExifImage>}\n */\nexport async function readExifData(file, buf) {\n // For avatar images the file.type is set as image/jpeg, however for images shared in an activity file.mimeType is set as image/jpeg. Handling both conditions.\n if (file && (file.type === 'image/jpeg' || file.mimeType === 'image/jpeg')) {\n const exifData = await parse(buf, {translateValues: false});\n\n if (exifData) {\n const {Orientation, ExifImageHeight, ExifImageWidth} = exifData;\n\n file.orientation = Orientation;\n file.exifHeight = ExifImageHeight;\n file.exifWidth = ExifImageWidth;\n\n if (file.image) {\n file.image.orientation = Orientation;\n }\n }\n }\n\n return buf;\n}\n\n/* eslint-disable complexity */\n/**\n * Rotates/flips the image on the canvas as per exif information\n * @param {Object} options(orientation: image exif orientation range from 1-8, img: Image object, x: start x-axis, y: start y-axis, width: width of the thumbnail, height: height of the thumbnail, ctx: canvas context)\n * @param {Object} file\n * @returns {Object}\n */\nexport function orient(options, file) {\n const {width, height, ctx, img, orientation, x, y} = options;\n\n if (file && file.orientation && file.orientation !== 1) {\n // explanation of orientation:\n // https://stackoverflow.com/questions/20600800/js-client-side-exif-orientation-rotate-and-mirror-jpeg-images\n switch (orientation) {\n case 2:\n // flip\n ctx.transform(-1, 0, 0, 1, width, 0);\n break;\n case 3:\n // rotateImage180\n ctx.transform(-1, 0, 0, -1, width, height);\n break;\n case 4:\n // rotate180AndFlipImage\n ctx.transform(1, 0, 0, -1, 0, height);\n break;\n case 5:\n // rotate90AndFlipImage\n ctx.transform(0, 1, 1, 0, 0, 0);\n break;\n case 6:\n // rotateImage90\n ctx.transform(0, 1, -1, 0, height, 0);\n break;\n case 7:\n // rotateNeg90AndFlipImage\n ctx.transform(0, -1, -1, 0, height, width);\n break;\n case 8:\n // rotateNeg90\n ctx.transform(0, -1, 1, 0, 0, width);\n break;\n default:\n break;\n }\n }\n ctx.drawImage(img, x, y, width, height);\n}\n/* eslint-enable complexity */\n\nexport {default as processImage} from './process-image';\nexport {default as detectFileType} from './detect-filetype';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkHA;AACA;AAnHA;AACA;AACA;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,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAEL,MAAM,CAAC;QACrC;MACF,KAAK,CAAC;QACJ;QACAC,GAAG,CAACI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC/B;MACF,KAAK,CAAC;QACJ;QACAJ,GAAG,CAACI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAEL,MAAM,EAAE,CAAC,CAAC;QACrC;MACF,KAAK,CAAC;QACJ;QACAC,GAAG,CAACI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAEL,MAAM,EAAED,KAAK,CAAC;QAC1C;MACF,KAAK,CAAC;QACJ;QACAE,GAAG,CAACI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEN,KAAK,CAAC;QACpC;MACF;QACE;IAAM;EAEZ;EACAE,GAAG,CAACK,SAAS,CAACJ,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEL,KAAK,EAAEC,MAAM,CAAC;AACzC;AACA"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = processImage;
|
|
12
|
-
|
|
13
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
14
|
-
|
|
15
10
|
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
16
|
-
|
|
17
11
|
var _index = require("./index");
|
|
18
|
-
|
|
19
12
|
/* eslint-env browser */
|
|
20
13
|
|
|
21
14
|
/**
|
|
@@ -29,14 +22,12 @@ var _index = require("./index");
|
|
|
29
22
|
*/
|
|
30
23
|
function computeDimensions(_ref, maxWidth, maxHeight) {
|
|
31
24
|
var width = _ref.width,
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
height = _ref.height;
|
|
34
26
|
if (height > width) {
|
|
35
27
|
if (height > maxHeight) {
|
|
36
28
|
width = width * maxHeight / height;
|
|
37
29
|
height = maxHeight;
|
|
38
30
|
}
|
|
39
|
-
|
|
40
31
|
if (width > maxWidth) {
|
|
41
32
|
height = height * maxWidth / width;
|
|
42
33
|
width = maxWidth;
|
|
@@ -46,18 +37,17 @@ function computeDimensions(_ref, maxWidth, maxHeight) {
|
|
|
46
37
|
height = height * maxWidth / width;
|
|
47
38
|
width = maxWidth;
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
if (height > maxHeight) {
|
|
51
41
|
width = width * maxHeight / height;
|
|
52
42
|
height = maxHeight;
|
|
53
43
|
}
|
|
54
44
|
}
|
|
55
|
-
|
|
56
45
|
return {
|
|
57
46
|
height: height,
|
|
58
47
|
width: width
|
|
59
48
|
};
|
|
60
49
|
}
|
|
50
|
+
|
|
61
51
|
/**
|
|
62
52
|
* Measures an image file and produces a thumbnail for it
|
|
63
53
|
* @param {Object} options
|
|
@@ -69,34 +59,27 @@ function computeDimensions(_ref, maxWidth, maxHeight) {
|
|
|
69
59
|
* @param {Boolean} options.isAvatar
|
|
70
60
|
* @returns {Promise<Array>} Buffer, Dimensions, thumbnailDimensions
|
|
71
61
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
62
|
function processImage(_ref2) {
|
|
75
63
|
var file = _ref2.file,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
type = _ref2.type,
|
|
65
|
+
thumbnailMaxWidth = _ref2.thumbnailMaxWidth,
|
|
66
|
+
thumbnailMaxHeight = _ref2.thumbnailMaxHeight,
|
|
67
|
+
enableThumbnails = _ref2.enableThumbnails,
|
|
68
|
+
logger = _ref2.logger,
|
|
69
|
+
isAvatar = _ref2.isAvatar;
|
|
83
70
|
if (!type || !type.startsWith('image')) {
|
|
84
71
|
return _promise.default.resolve();
|
|
85
72
|
}
|
|
86
|
-
|
|
87
73
|
file = file instanceof Blob ? file : new Blob([file]);
|
|
88
74
|
return new _promise.default(function (resolve, reject) {
|
|
89
75
|
var img = new Image();
|
|
90
|
-
|
|
91
76
|
img.onload = function onload() {
|
|
92
77
|
resolve(img);
|
|
93
78
|
};
|
|
94
|
-
|
|
95
79
|
img.onerror = reject;
|
|
96
80
|
img.src = URL.createObjectURL(file);
|
|
97
81
|
}).then(function (img) {
|
|
98
82
|
var fileDimensions = (0, _pick2.default)(img, 'height', 'width');
|
|
99
|
-
|
|
100
83
|
if (isAvatar) {
|
|
101
84
|
// only if image is a profile avatar
|
|
102
85
|
logger.info('dimensions will be set for avatar image');
|
|
@@ -104,19 +87,18 @@ function processImage(_ref2) {
|
|
|
104
87
|
fileDimensions.height = size;
|
|
105
88
|
fileDimensions.width = size;
|
|
106
89
|
}
|
|
107
|
-
|
|
108
90
|
if (!enableThumbnails) {
|
|
109
91
|
logger.info('thumbnails not enabled');
|
|
110
92
|
return [null, fileDimensions, null];
|
|
111
93
|
}
|
|
112
|
-
|
|
113
94
|
var thumbnailDimensions = computeDimensions(fileDimensions, thumbnailMaxWidth, thumbnailMaxHeight);
|
|
114
95
|
var canvas = document.createElement('canvas');
|
|
115
96
|
var ctx = canvas.getContext('2d');
|
|
116
97
|
var width = thumbnailDimensions.width,
|
|
117
|
-
|
|
118
|
-
// https://stackoverflow.com/questions/20600800/js-client-side-exif-orientation-rotate-and-mirror-jpeg-images
|
|
98
|
+
height = thumbnailDimensions.height;
|
|
119
99
|
|
|
100
|
+
// explanation of orientation:
|
|
101
|
+
// https://stackoverflow.com/questions/20600800/js-client-side-exif-orientation-rotate-and-mirror-jpeg-images
|
|
120
102
|
if (file.orientation && file.orientation > 4) {
|
|
121
103
|
canvas.width = height;
|
|
122
104
|
canvas.height = width;
|
|
@@ -126,7 +108,6 @@ function processImage(_ref2) {
|
|
|
126
108
|
canvas.width = thumbnailDimensions.width;
|
|
127
109
|
canvas.height = thumbnailDimensions.height;
|
|
128
110
|
}
|
|
129
|
-
|
|
130
111
|
(0, _index.orient)({
|
|
131
112
|
orientation: file && file.orientation ? file.orientation : '',
|
|
132
113
|
img: img,
|
|
@@ -136,16 +117,14 @@ function processImage(_ref2) {
|
|
|
136
117
|
height: height,
|
|
137
118
|
ctx: ctx
|
|
138
119
|
}, file);
|
|
139
|
-
var parts = canvas.toDataURL('image/png').split(',');
|
|
140
|
-
|
|
120
|
+
var parts = canvas.toDataURL('image/png').split(',');
|
|
121
|
+
// Thumbnail uploads were failing with common/base64 decoding
|
|
141
122
|
var byteString = atob(parts[1]);
|
|
142
123
|
var buffer = new ArrayBuffer(byteString.length);
|
|
143
124
|
var view = new DataView(buffer);
|
|
144
|
-
|
|
145
125
|
for (var i = 0; i < byteString.length; i += 1) {
|
|
146
126
|
view.setUint8(i, byteString.charCodeAt(i));
|
|
147
127
|
}
|
|
148
|
-
|
|
149
128
|
return [buffer, fileDimensions, thumbnailDimensions];
|
|
150
129
|
});
|
|
151
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["computeDimensions","maxWidth","maxHeight","width","height","processImage","file","type","thumbnailMaxWidth","thumbnailMaxHeight","enableThumbnails","logger","isAvatar","startsWith","resolve","Blob","reject","img","Image","onload","onerror","src","URL","createObjectURL","then","fileDimensions","info","size","thumbnailDimensions","canvas","document","createElement","ctx","getContext","orientation","orient","x","y","parts","toDataURL","split","byteString","atob","buffer","ArrayBuffer","length","view","DataView","i","setUint8","charCodeAt"],"sources":["process-image.browser.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {pick} from 'lodash';\n\nimport {orient} from './index';\n/* eslint-env browser */\n\n/**\n * Determins the dimensions of an image\n * @param {Object} constraints\n * @param {Number} constraints.width\n * @param {Number} constraints.height\n * @param {Number} maxWidth\n * @param {Number} maxHeight\n * @returns {Object}\n */\nfunction computeDimensions({width, height}, maxWidth, maxHeight) {\n if (height > width) {\n if (height > maxHeight) {\n width = (width * maxHeight) / height;\n height = maxHeight;\n }\n\n if (width > maxWidth) {\n height = (height * maxWidth) / width;\n width = maxWidth;\n }\n } else {\n if (width > maxWidth) {\n height = (height * maxWidth) / width;\n width = maxWidth;\n }\n\n if (height > maxHeight) {\n width = (width * maxHeight) / height;\n height = maxHeight;\n }\n }\n\n return {height, width};\n}\n\n/**\n * Measures an image file and produces a thumbnail for it\n * @param {Object} options\n * @param {Blob|ArrayBuffer} options.file\n * @param {Number} options.thumbnailMaxWidth\n * @param {Number} options.thumbnailMaxHeight\n * @param {Boolean} options.enableThumbnails\n * @param {Object} options.logger\n * @param {Boolean} options.isAvatar\n * @returns {Promise<Array>} Buffer, Dimensions, thumbnailDimensions\n */\nexport default function processImage({\n file,\n type,\n thumbnailMaxWidth,\n thumbnailMaxHeight,\n enableThumbnails,\n logger,\n isAvatar,\n}) {\n if (!type || !type.startsWith('image')) {\n return Promise.resolve();\n }\n\n file = file instanceof Blob ? file : new Blob([file]);\n\n return new Promise((resolve, reject) => {\n const img = new Image();\n\n img.onload = function onload() {\n resolve(img);\n };\n img.onerror = reject;\n img.src = URL.createObjectURL(file);\n }).then((img) => {\n const fileDimensions = pick(img, 'height', 'width');\n\n if (isAvatar) {\n // only if image is a profile avatar\n logger.info('dimensions will be set for avatar image');\n const size =\n fileDimensions.height > fileDimensions.width ? fileDimensions.height : fileDimensions.width;\n\n fileDimensions.height = size;\n fileDimensions.width = size;\n }\n if (!enableThumbnails) {\n logger.info('thumbnails not enabled');\n\n return [null, fileDimensions, null];\n }\n const thumbnailDimensions = computeDimensions(\n fileDimensions,\n thumbnailMaxWidth,\n thumbnailMaxHeight\n );\n\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n const {width, height} = thumbnailDimensions;\n\n // explanation of orientation:\n // https://stackoverflow.com/questions/20600800/js-client-side-exif-orientation-rotate-and-mirror-jpeg-images\n if (file.orientation && file.orientation > 4) {\n canvas.width = height;\n canvas.height = width;\n thumbnailDimensions.width = height;\n thumbnailDimensions.height = width;\n } else {\n canvas.width = thumbnailDimensions.width;\n canvas.height = thumbnailDimensions.height;\n }\n\n orient(\n {\n orientation: file && file.orientation ? file.orientation : '',\n img,\n x: 0,\n y: 0,\n width,\n height,\n ctx,\n },\n file\n );\n\n const parts = canvas.toDataURL('image/png').split(',');\n // Thumbnail uploads were failing with common/base64 decoding\n const byteString = atob(parts[1]);\n\n const buffer = new ArrayBuffer(byteString.length);\n const view = new DataView(buffer);\n\n for (let i = 0; i < byteString.length; i += 1) {\n view.setUint8(i, byteString.charCodeAt(i));\n }\n\n return [buffer, fileDimensions, thumbnailDimensions];\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["computeDimensions","maxWidth","maxHeight","width","height","processImage","file","type","thumbnailMaxWidth","thumbnailMaxHeight","enableThumbnails","logger","isAvatar","startsWith","resolve","Blob","reject","img","Image","onload","onerror","src","URL","createObjectURL","then","fileDimensions","info","size","thumbnailDimensions","canvas","document","createElement","ctx","getContext","orientation","orient","x","y","parts","toDataURL","split","byteString","atob","buffer","ArrayBuffer","length","view","DataView","i","setUint8","charCodeAt"],"sources":["process-image.browser.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {pick} from 'lodash';\n\nimport {orient} from './index';\n/* eslint-env browser */\n\n/**\n * Determins the dimensions of an image\n * @param {Object} constraints\n * @param {Number} constraints.width\n * @param {Number} constraints.height\n * @param {Number} maxWidth\n * @param {Number} maxHeight\n * @returns {Object}\n */\nfunction computeDimensions({width, height}, maxWidth, maxHeight) {\n if (height > width) {\n if (height > maxHeight) {\n width = (width * maxHeight) / height;\n height = maxHeight;\n }\n\n if (width > maxWidth) {\n height = (height * maxWidth) / width;\n width = maxWidth;\n }\n } else {\n if (width > maxWidth) {\n height = (height * maxWidth) / width;\n width = maxWidth;\n }\n\n if (height > maxHeight) {\n width = (width * maxHeight) / height;\n height = maxHeight;\n }\n }\n\n return {height, width};\n}\n\n/**\n * Measures an image file and produces a thumbnail for it\n * @param {Object} options\n * @param {Blob|ArrayBuffer} options.file\n * @param {Number} options.thumbnailMaxWidth\n * @param {Number} options.thumbnailMaxHeight\n * @param {Boolean} options.enableThumbnails\n * @param {Object} options.logger\n * @param {Boolean} options.isAvatar\n * @returns {Promise<Array>} Buffer, Dimensions, thumbnailDimensions\n */\nexport default function processImage({\n file,\n type,\n thumbnailMaxWidth,\n thumbnailMaxHeight,\n enableThumbnails,\n logger,\n isAvatar,\n}) {\n if (!type || !type.startsWith('image')) {\n return Promise.resolve();\n }\n\n file = file instanceof Blob ? file : new Blob([file]);\n\n return new Promise((resolve, reject) => {\n const img = new Image();\n\n img.onload = function onload() {\n resolve(img);\n };\n img.onerror = reject;\n img.src = URL.createObjectURL(file);\n }).then((img) => {\n const fileDimensions = pick(img, 'height', 'width');\n\n if (isAvatar) {\n // only if image is a profile avatar\n logger.info('dimensions will be set for avatar image');\n const size =\n fileDimensions.height > fileDimensions.width ? fileDimensions.height : fileDimensions.width;\n\n fileDimensions.height = size;\n fileDimensions.width = size;\n }\n if (!enableThumbnails) {\n logger.info('thumbnails not enabled');\n\n return [null, fileDimensions, null];\n }\n const thumbnailDimensions = computeDimensions(\n fileDimensions,\n thumbnailMaxWidth,\n thumbnailMaxHeight\n );\n\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n const {width, height} = thumbnailDimensions;\n\n // explanation of orientation:\n // https://stackoverflow.com/questions/20600800/js-client-side-exif-orientation-rotate-and-mirror-jpeg-images\n if (file.orientation && file.orientation > 4) {\n canvas.width = height;\n canvas.height = width;\n thumbnailDimensions.width = height;\n thumbnailDimensions.height = width;\n } else {\n canvas.width = thumbnailDimensions.width;\n canvas.height = thumbnailDimensions.height;\n }\n\n orient(\n {\n orientation: file && file.orientation ? file.orientation : '',\n img,\n x: 0,\n y: 0,\n width,\n height,\n ctx,\n },\n file\n );\n\n const parts = canvas.toDataURL('image/png').split(',');\n // Thumbnail uploads were failing with common/base64 decoding\n const byteString = atob(parts[1]);\n\n const buffer = new ArrayBuffer(byteString.length);\n const view = new DataView(buffer);\n\n for (let i = 0; i < byteString.length; i += 1) {\n view.setUint8(i, byteString.charCodeAt(i));\n }\n\n return [buffer, fileDimensions, thumbnailDimensions];\n });\n}\n"],"mappings":";;;;;;;;;;AAMA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAiB,OAAkBC,QAAQ,EAAEC,SAAS,EAAE;EAAA,IAArCC,KAAK,QAALA,KAAK;IAAEC,MAAM,QAANA,MAAM;EACvC,IAAIA,MAAM,GAAGD,KAAK,EAAE;IAClB,IAAIC,MAAM,GAAGF,SAAS,EAAE;MACtBC,KAAK,GAAIA,KAAK,GAAGD,SAAS,GAAIE,MAAM;MACpCA,MAAM,GAAGF,SAAS;IACpB;IAEA,IAAIC,KAAK,GAAGF,QAAQ,EAAE;MACpBG,MAAM,GAAIA,MAAM,GAAGH,QAAQ,GAAIE,KAAK;MACpCA,KAAK,GAAGF,QAAQ;IAClB;EACF,CAAC,MAAM;IACL,IAAIE,KAAK,GAAGF,QAAQ,EAAE;MACpBG,MAAM,GAAIA,MAAM,GAAGH,QAAQ,GAAIE,KAAK;MACpCA,KAAK,GAAGF,QAAQ;IAClB;IAEA,IAAIG,MAAM,GAAGF,SAAS,EAAE;MACtBC,KAAK,GAAIA,KAAK,GAAGD,SAAS,GAAIE,MAAM;MACpCA,MAAM,GAAGF,SAAS;IACpB;EACF;EAEA,OAAO;IAACE,MAAM,EAANA,MAAM;IAAED,KAAK,E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,CAACC,KAAK,CAAC,GAAG,CAAC;IACtD;IACA,IAAMC,UAAU,GAAGC,IAAI,CAACJ,KAAK,CAAC,CAAC,CAAC,CAAC;IAEjC,IAAMK,MAAM,GAAG,IAAIC,WAAW,CAACH,UAAU,CAACI,MAAM,CAAC;IACjD,IAAMC,IAAI,GAAG,IAAIC,QAAQ,CAACJ,MAAM,CAAC;IAEjC,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGP,UAAU,CAACI,MAAM,EAAEG,CAAC,IAAI,CAAC,EAAE;MAC7CF,IAAI,CAACG,QAAQ,CAACD,CAAC,EAAEP,UAAU,CAACS,UAAU,CAACF,CAAC,CAAC,CAAC;IAC5C;IAEA,OAAO,CAACL,MAAM,EAAElB,cAAc,EAAEG,mBAAmB,CAAC;EACtD,CAAC,CAAC;AACJ"}
|
package/dist/process-image.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = processImage;
|
|
12
|
-
|
|
13
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
14
|
-
|
|
15
10
|
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
16
|
-
|
|
17
11
|
var _gm = _interopRequireDefault(require("gm"));
|
|
18
|
-
|
|
19
12
|
/*!
|
|
20
13
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
21
14
|
*/
|
|
@@ -32,30 +25,26 @@ var _gm = _interopRequireDefault(require("gm"));
|
|
|
32
25
|
*/
|
|
33
26
|
function processImage(_ref) {
|
|
34
27
|
var file = _ref.file,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
type = _ref.type,
|
|
29
|
+
thumbnailMaxWidth = _ref.thumbnailMaxWidth,
|
|
30
|
+
thumbnailMaxHeight = _ref.thumbnailMaxHeight,
|
|
31
|
+
enableThumbnails = _ref.enableThumbnails,
|
|
32
|
+
logger = _ref.logger;
|
|
40
33
|
var fileType = type || file.type;
|
|
41
|
-
|
|
42
34
|
if (!fileType || !fileType.startsWith('image')) {
|
|
43
35
|
return _promise.default.resolve();
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
var fileDimensions = new _promise.default(function (resolve, reject) {
|
|
47
38
|
(0, _gm.default)(file).size(function (err, size) {
|
|
48
39
|
if (err) {
|
|
49
40
|
reject(err);
|
|
50
41
|
return;
|
|
51
42
|
}
|
|
52
|
-
|
|
53
43
|
resolve((0, _pick2.default)(size, 'width', 'height'));
|
|
54
44
|
});
|
|
55
45
|
});
|
|
56
46
|
var thumbnail;
|
|
57
47
|
var thumbnailDimensions;
|
|
58
|
-
|
|
59
48
|
if (enableThumbnails) {
|
|
60
49
|
thumbnail = new _promise.default(function (resolve, reject) {
|
|
61
50
|
(0, _gm.default)(file).resize(thumbnailMaxWidth, thumbnailMaxHeight).autoOrient().toBuffer('PNG', function (err, buffer) {
|
|
@@ -63,7 +52,6 @@ function processImage(_ref) {
|
|
|
63
52
|
reject(err);
|
|
64
53
|
return;
|
|
65
54
|
}
|
|
66
|
-
|
|
67
55
|
resolve(buffer);
|
|
68
56
|
});
|
|
69
57
|
});
|
|
@@ -74,31 +62,25 @@ function processImage(_ref) {
|
|
|
74
62
|
reject(err);
|
|
75
63
|
return;
|
|
76
64
|
}
|
|
77
|
-
|
|
78
65
|
resolve((0, _pick2.default)(size, 'width', 'height'));
|
|
79
66
|
});
|
|
80
67
|
});
|
|
81
68
|
});
|
|
82
69
|
}
|
|
83
|
-
|
|
84
70
|
return _promise.default.all([thumbnail, fileDimensions, thumbnailDimensions]).catch(function (err) {
|
|
85
71
|
var errorString = err.toString();
|
|
86
|
-
|
|
87
72
|
if (errorString.includes('EPIPE')) {
|
|
88
73
|
logger.warn(err, 'Is GraphicsMagick installed?');
|
|
89
74
|
return _promise.default.resolve();
|
|
90
75
|
}
|
|
91
|
-
|
|
92
76
|
if (errorString.includes('No decode delegate for this image format')) {
|
|
93
77
|
logger.debug(err, 'File does not appear to be an image');
|
|
94
78
|
return _promise.default.resolve();
|
|
95
79
|
}
|
|
96
|
-
|
|
97
80
|
if (errorString.includes('Stream yields empty buffer')) {
|
|
98
81
|
logger.debug(err, 'File does not appear to be an image');
|
|
99
82
|
return _promise.default.resolve();
|
|
100
83
|
}
|
|
101
|
-
|
|
102
84
|
return _promise.default.reject(err);
|
|
103
85
|
});
|
|
104
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["processImage","file","type","thumbnailMaxWidth","thumbnailMaxHeight","enableThumbnails","logger","fileType","startsWith","resolve","fileDimensions","reject","gm","size","err","thumbnail","thumbnailDimensions","resize","autoOrient","toBuffer","buffer","then","all","catch","errorString","toString","includes","warn","debug"],"sources":["process-image.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport gm from 'gm';\nimport {pick} from 'lodash';\n\n/**\n * Measures an image file and produces a thumbnail for it\n * @param {Object} options\n * @param {Blob|ArrayBuffer} options.file\n * @param {Number} options.thumbnailMaxWidth\n * @param {Number} options.thumbnailMaxHeight\n * @param {Boolean} options.enableThumbnails\n * @param {Object} options.logger\n * @returns {Promise<Array>} Buffer, Dimensions, thumbnailDimensions\n */\nexport default function processImage({\n file,\n type,\n thumbnailMaxWidth,\n thumbnailMaxHeight,\n enableThumbnails,\n logger,\n}) {\n const fileType = type || file.type;\n\n if (!fileType || !fileType.startsWith('image')) {\n return Promise.resolve();\n }\n\n const fileDimensions = new Promise((resolve, reject) => {\n gm(file).size((err, size) => {\n if (err) {\n reject(err);\n\n return;\n }\n\n resolve(pick(size, 'width', 'height'));\n });\n });\n\n let thumbnail;\n let thumbnailDimensions;\n\n if (enableThumbnails) {\n thumbnail = new Promise((resolve, reject) => {\n gm(file)\n .resize(thumbnailMaxWidth, thumbnailMaxHeight)\n .autoOrient()\n .toBuffer('PNG', (err, buffer) => {\n if (err) {\n reject(err);\n\n return;\n }\n\n resolve(buffer);\n });\n });\n\n thumbnailDimensions = thumbnail.then(\n (buffer) =>\n new Promise((resolve, reject) => {\n gm(buffer).size((err, size) => {\n if (err) {\n reject(err);\n\n return;\n }\n\n resolve(pick(size, 'width', 'height'));\n });\n })\n );\n }\n\n return Promise.all([thumbnail, fileDimensions, thumbnailDimensions]).catch((err) => {\n const errorString = err.toString();\n\n if (errorString.includes('EPIPE')) {\n logger.warn(err, 'Is GraphicsMagick installed?');\n\n return Promise.resolve();\n }\n\n if (errorString.includes('No decode delegate for this image format')) {\n logger.debug(err, 'File does not appear to be an image');\n\n return Promise.resolve();\n }\n\n if (errorString.includes('Stream yields empty buffer')) {\n logger.debug(err, 'File does not appear to be an image');\n\n return Promise.resolve();\n }\n\n return Promise.reject(err);\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["processImage","file","type","thumbnailMaxWidth","thumbnailMaxHeight","enableThumbnails","logger","fileType","startsWith","resolve","fileDimensions","reject","gm","size","err","thumbnail","thumbnailDimensions","resize","autoOrient","toBuffer","buffer","then","all","catch","errorString","toString","includes","warn","debug"],"sources":["process-image.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport gm from 'gm';\nimport {pick} from 'lodash';\n\n/**\n * Measures an image file and produces a thumbnail for it\n * @param {Object} options\n * @param {Blob|ArrayBuffer} options.file\n * @param {Number} options.thumbnailMaxWidth\n * @param {Number} options.thumbnailMaxHeight\n * @param {Boolean} options.enableThumbnails\n * @param {Object} options.logger\n * @returns {Promise<Array>} Buffer, Dimensions, thumbnailDimensions\n */\nexport default function processImage({\n file,\n type,\n thumbnailMaxWidth,\n thumbnailMaxHeight,\n enableThumbnails,\n logger,\n}) {\n const fileType = type || file.type;\n\n if (!fileType || !fileType.startsWith('image')) {\n return Promise.resolve();\n }\n\n const fileDimensions = new Promise((resolve, reject) => {\n gm(file).size((err, size) => {\n if (err) {\n reject(err);\n\n return;\n }\n\n resolve(pick(size, 'width', 'height'));\n });\n });\n\n let thumbnail;\n let thumbnailDimensions;\n\n if (enableThumbnails) {\n thumbnail = new Promise((resolve, reject) => {\n gm(file)\n .resize(thumbnailMaxWidth, thumbnailMaxHeight)\n .autoOrient()\n .toBuffer('PNG', (err, buffer) => {\n if (err) {\n reject(err);\n\n return;\n }\n\n resolve(buffer);\n });\n });\n\n thumbnailDimensions = thumbnail.then(\n (buffer) =>\n new Promise((resolve, reject) => {\n gm(buffer).size((err, size) => {\n if (err) {\n reject(err);\n\n return;\n }\n\n resolve(pick(size, 'width', 'height'));\n });\n })\n );\n }\n\n return Promise.all([thumbnail, fileDimensions, thumbnailDimensions]).catch((err) => {\n const errorString = err.toString();\n\n if (errorString.includes('EPIPE')) {\n logger.warn(err, 'Is GraphicsMagick installed?');\n\n return Promise.resolve();\n }\n\n if (errorString.includes('No decode delegate for this image format')) {\n logger.debug(err, 'File does not appear to be an image');\n\n return Promise.resolve();\n }\n\n if (errorString.includes('Stream yields empty buffer')) {\n logger.debug(err, 'File does not appear to be an image');\n\n return Promise.resolve();\n }\n\n return Promise.reject(err);\n });\n}\n"],"mappings":";;;;;;;;;;AAIA;AAJA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,YAAY,OAOjC;EAAA,IANDC,IAAI,QAAJA,IAAI;IACJC,IAAI,QAAJA,IAAI;IACJC,iBAAiB,QAAjBA,iBAAiB;IACjBC,kBAAkB,QAAlBA,kBAAkB;IAClBC,gBAAgB,QAAhBA,gBAAgB;IAChBC,MAAM,QAANA,MAAM;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EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC;MACJ,CAAC,CAAC;IAAA,EACL;EACH;EAEA,OAAO,iBAAQS,GAAG,CAAC,CAACP,SAAS,EAAEL,cAAc,EAAEM,mBAAmB,CAAC,CAAC,CAACO,KAAK,CAAC,UAACT,GAAG,EAAK;IAClF,IAAMU,WAAW,GAAGV,GAAG,CAACW,QAAQ,EAAE;IAElC,IAAID,WAAW,CAACE,QAAQ,CAAC,OAAO,CAAC,EAAE;MACjCpB,MAAM,CAACqB,IAAI,CAACb,GAAG,EAAE,8BAA8B,CAAC;MAEhD,OAAO,iBAAQL,OAAO,EAAE;IAC1B;IAEA,IAAIe,WAAW,CAACE,QAAQ,CAAC,0CAA0C,CAAC,EAAE;MACpEpB,MAAM,CAACsB,KAAK,CAACd,GAAG,EAAE,qCAAqC,CAAC;MAExD,OAAO,iBAAQL,OAAO,EAAE;IAC1B;IAEA,IAAIe,WAAW,CAACE,QAAQ,CAAC,4BAA4B,CAAC,EAAE;MACtDpB,MAAM,CAACsB,KAAK,CAACd,GAAG,EAAE,qCAAqC,CAAC;MAExD,OAAO,iBAAQL,OAAO,EAAE;IAC1B;IAEA,OAAO,iBAAQE,MAAM,CAACG,GAAG,CAAC;EAC5B,CAAC,CAAC;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/helper-image",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.151",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Saurabh Jain <saurjai3@cisco.com>",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"sinon": "^9.2.4"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@webex/helper-image": "3.0.0-beta.
|
|
32
|
-
"@webex/http-core": "3.0.0-beta.
|
|
33
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
34
|
-
"@webex/test-helper-file": "3.0.0-beta.
|
|
35
|
-
"@webex/test-helper-mocha": "3.0.0-beta.
|
|
31
|
+
"@webex/helper-image": "3.0.0-beta.151",
|
|
32
|
+
"@webex/http-core": "3.0.0-beta.151",
|
|
33
|
+
"@webex/test-helper-chai": "3.0.0-beta.151",
|
|
34
|
+
"@webex/test-helper-file": "3.0.0-beta.151",
|
|
35
|
+
"@webex/test-helper-mocha": "3.0.0-beta.151",
|
|
36
36
|
"exifr": "^5.0.3",
|
|
37
37
|
"gm": "^1.23.1",
|
|
38
38
|
"lodash": "^4.17.21",
|