|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We use Dropzone (the photo upload library) to shrink photos client-side
before uploading in the background and display thumbnails. For the
resized upload, Dropzone restores the original Exif data, including
orientation, so it can be correctly oriented server-side; for a
thumbnail, it orients the image itself for immediate display.
Recently, browsers have started honouring Exif orientation much more
widely (Chrome 81+ and Firefox 77+ both now do it by default). This
means the data Dropzone gets from a resize has already been oriented
according to the Exif orientation data. Then Dropzone either looks at
the orientation to correct for display (thumbnail), or adds back the
Exif orientation data (upload) – in both cases, this leads to a double
implementation of the orientation, and an incorrect display.
To fix this, if we detect we are on a modern browser, we do not try and
fix orientation ourself [1], and in all cases we do not add any Exif
data back in (we only strip it server-side anyway). Conversely, that
means on a non-modern browser, we always perform a manual orientation
because no Exif data will be being sent server-side.
Also includes a fix to the orientation code [2] which wouldn't be
noticed in thumbnail generation as they are square, but could be now we
may be orienting full size photos.
[1] https://gitlab.com/meno/dropzone/-/merge_requests/80
[2] https://gitlab.com/meno/dropzone/-/merge_requests/45
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The newest version of Dropzone has added support for client-side resizing of
images, so this commit upgrades to version 5.1.1 and takes advantage of that in
order to reduce the disc space consumed by uploaded images.
The target size & JPEG quality is quite aggressive, resulting in files in the
region of 200-300KB instead of several MB. I've tried to pick a value which
doesn't impact the usefulness of the photos in identifying problems.
Handily the new version also correctly rotates images according to the EXIF tag
so our patch has be reduced dramatically to deal with the sync nature of the
mini EXIF library in use.
Related to the disc space part of #1411, though EXIF metadata isn't stripped.
|