Commit 781e1c19862d0d3327dd9a68e0c497d9f876cc0f
Better error handling for exif data
Anders Rune Jensen committed on 6/20/2018, 6:52:49 PMParent: 9780f1d1ea686a20193f24c7b7f4f606c46cee77
Files changed
blob/html/input.js | changed |
blob/html/input.js | ||
---|---|---|
@@ -28,13 +28,22 @@ | ||
28 | 28 … | var mimeType = mime(file.name) |
29 | 29 … | var fileName = file.name |
30 | 30 … | |
31 | 31 … | getFileData(file, function(fileData) { |
32 | - var orientation = getOrientation(fileData) | |
32 … | + var orientation = 0; | |
33 … | + if (mimeType == "image/jpeg") { | |
34 … | + try { | |
35 … | + orientation = getOrientation(fileData) | |
33 | 36 … | |
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 … | + } | |
37 | 46 … | |
38 | 47 … | // handle exif orientation data and resize |
39 | 48 … | if (orientation >= 3 || opts.resize) { |
40 | 49 … | getImage(fileData, (image) => { |
Built with git-ssb-web