git ssb

7+

dinoworm 🐛 / patchcore



Commit 781e1c19862d0d3327dd9a68e0c497d9f876cc0f

Better error handling for exif data

Anders Rune Jensen committed on 6/20/2018, 6:52:49 PM
Parent: 9780f1d1ea686a20193f24c7b7f4f606c46cee77

Files changed

blob/html/input.jschanged
blob/html/input.jsView
@@ -28,13 +28,22 @@
2828 var mimeType = mime(file.name)
2929 var fileName = file.name
3030
3131 getFileData(file, function(fileData) {
32- var orientation = getOrientation(fileData)
32 + var orientation = 0;
33 + if (mimeType == "image/jpeg") {
34 + try {
35 + orientation = getOrientation(fileData)
3336
34- if ((typeof opts.removeExif == 'function' && opts.removeExif()) ||
35- opts.removeExif === true)
36- fileData = removeExif(fileData, orientation)
37 + if ((typeof opts.removeExif == 'function' && opts.removeExif()) ||
38 + opts.removeExif === true)
39 + fileData = removeExif(fileData, orientation)
40 + }
41 + catch (ex)
42 + {
43 + console.log("exif exception:", ex)
44 + }
45 + }
3746
3847 // handle exif orientation data and resize
3948 if (orientation >= 3 || opts.resize) {
4049 getImage(fileData, (image) => {

Built with git-ssb-web