Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dropzone.on('addedfile', function(file) {
var self = this;
//in bulletins this container is hidden so you can see error message
if (self.previewsContainer.classList.contains('hidden')) {
self.previewsContainer.classList.remove('hidden');
}
loadImage.parseMetaData(file, function (data) {
// use embedded thumbnail if exists.
if (data.exif) {
var thumbnail = data.exif.get('Thumbnail');
var orientation = data.exif.get('Orientation');
if (thumbnail && orientation) {
loadImage(thumbnail, function (img) {
self.emit('thumbnail', file, img.toDataURL());
}, { orientation: orientation });
return;
}
}
// use default implementation for PNG, etc.
self.createThumbnail(file);
});
});
const file = fileInput.files[0];
if (file === undefined) {
return;
}
if (file.size > 2 * 1024 * 1024) {
// If file size is greater than 2 MB, show error message
this.setState({
isImageOversize: true,
});
return;
}
this.setState({
isImageOversize: false,
});
uploadPhotoInit();
loadImage.parseMetaData(file, (data) => {
let orientation = 0;
if (data.exif) {
orientation = data.exif.get('Orientation');
}
loadImage(
file,
(img) => {
img.toBlob(
(blobResult) => {
uploadPhoto(handle, tokenV3, blobResult);
},
);
}, {
canvas: true,
orientation,
},
const info = await Device.getInfo();
let thumbnailData = null;
let viewerData = null;
thumbnailData = await PhotosService.compressPhoto(
tempFile,
PhotoType.Thumbnail,
tempFile.type
);
if (info.model !== 'iPhone' && info.model !== 'iPad') {
viewerData = await PhotosService.compressPhoto(
tempFile,
PhotoType.Viewer,
tempFile.type
);
}
loadImage.parseMetaData(
tempFile,
data => {
const reader = new FileReader();
let orientation = 1;
if (data && data.exif) {
orientation = data.exif.get('Orientation');
}
// Closure to capture the file information.
reader.onload = ((loadedFile, loadedList, loadedOrientation) => {
return async event => {
const originalData = event.target.result;
if (loadedOrientation) {
loadedFile.exifdata = {
tags: {