aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/dropzone.js.patch
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-06-20 11:45:35 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-07-06 13:04:13 +0100
commite591e68dae22695c688590d4b866f3158f4f2604 (patch)
tree25fa7f0b30750860f3711a8532d52cf9bfa10df0 /web/js/dropzone.js.patch
parentf74c7910b72f41f4a72d8b6b1a683fcf9fbb244e (diff)
Patch Dropzone to correctly orient preview images.
Include a patch file, applied to Dropzone as of version e524e03c, that also includes our previous Opera patch from 445e9a3d. The new minified file is our cut-down exif.js plus the patched dropzone.js.
Diffstat (limited to 'web/js/dropzone.js.patch')
-rw-r--r--web/js/dropzone.js.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/web/js/dropzone.js.patch b/web/js/dropzone.js.patch
new file mode 100644
index 000000000..030b56a6a
--- /dev/null
+++ b/web/js/dropzone.js.patch
@@ -0,0 +1,36 @@
+--- web/js/src/dropzone.orig.js 2016-06-17 21:29:47.000000000 +0100
++++ web/js/src/dropzone.js 2016-06-20 11:40:55.000000000 +0100
+@@ -1469,7 +1469,7 @@
+ return _results;
+ };
+
+- Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i];
++ Dropzone.blacklistedBrowsers = [/opera.*(Windows Phone|Macintosh).*version\/12/i];
+
+ Dropzone.isBrowserSupported = function() {
+ var capableBrowser, regex, _i, _len, _ref;
+@@ -1679,7 +1679,23 @@
+ drawImageIOSFix = function(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {
+ var vertSquashRatio;
+ vertSquashRatio = detectVerticalSquash(img);
+- return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
++ dh = dh / vertSquashRatio;
++
++ /* An improved version of http://stackoverflow.com/a/28356942/669631 */
++ var orientation = 0;
++ switch (EXIF.getData(img)) {
++ case 3: orientation = 2; break;
++ case 6: orientation = 1; break;
++ case 8: orientation = -1; break;
++ }
++ if (orientation) {
++ ctx.translate(dx + dw/2, dy + dh/2);
++ ctx.rotate(orientation * Math.PI / 2);
++ dx = -dw/2;
++ dy = -dh/2;
++ }
++
++ return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh);
+ };
+
+