sforkowany z mirror/soapbox
Merge branch 'exif-async' into 'develop'
Load exif.js library asynchronously See merge request soapbox-pub/soapbox-fe!748v1.x.x
commit
726d13e989
|
@ -1,6 +1,4 @@
|
||||||
/* eslint-disable no-case-declarations */
|
/* eslint-disable no-case-declarations */
|
||||||
import EXIF from 'exif-js';
|
|
||||||
|
|
||||||
const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
|
const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
|
||||||
|
|
||||||
const _browser_quirks = {};
|
const _browser_quirks = {};
|
||||||
|
@ -115,14 +113,16 @@ const getOrientation = (img, type = 'image/png') => new Promise(resolve => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXIF.getData(img, () => {
|
import(/* webpackChunkName: "features/compose" */'exif-js').then(({ default: EXIF }) => {
|
||||||
const orientation = EXIF.getTag(img, 'Orientation');
|
EXIF.getData(img, () => {
|
||||||
if (orientation !== 1) {
|
const orientation = EXIF.getTag(img, 'Orientation');
|
||||||
dropOrientationIfNeeded(orientation).then(resolve).catch(() => resolve(orientation));
|
if (orientation !== 1) {
|
||||||
} else {
|
dropOrientationIfNeeded(orientation).then(resolve).catch(() => resolve(orientation));
|
||||||
resolve(orientation);
|
} else {
|
||||||
}
|
resolve(orientation);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}).catch(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
const processImage = (img, { width, height, orientation, type = 'image/png', name = 'resized.png' }) => new Promise(resolve => {
|
const processImage = (img, { width, height, orientation, type = 'image/png', name = 'resized.png' }) => new Promise(resolve => {
|
||||||
|
|
Ładowanie…
Reference in New Issue