Upload / Up1

Client-side encrypted image host web server
MIT License
813 stars 97 forks source link

Image rotation not working #49

Closed tehmaze closed 8 years ago

tehmaze commented 8 years ago
Problem:

Images with EXIF orientation set are not properly rotated on display.

Steps to reproduce:

Upload a JPEG with Orientation field set to 90 degrees CW/CCW in the EXIF tags.

Expected:

Expected the image to show as portrait, but in stead the image is in landscape mode.

Preview is not working: Preview

Show in browser works as expected: Show in browser

tehmaze commented 8 years ago

For completeness:

% exiftool IMG_7783.jpg | grep Orientation
Orientation                     : Rotate 90 CW
andre-d commented 8 years ago

Submit a bug with your browser vendor. The only way this is resolved by other image hosts is reading the exif data and manually rotating it themselves on the server on upload which is not a case a client side processed host can handle. On Feb 8, 2016 6:32 AM, "tehmaze" notifications@github.com wrote:

For completeness:

% exiftool IMG_7783.jpg | grep Orientation Orientation : Rotate 90 CW

— Reply to this email directly or view it on GitHub https://github.com/Upload/Up1/issues/49#issuecomment-181327127.

anarcat commented 6 years ago

There's an image-rotation specification in CSS3 you must use to have this work, and it only works in Firefox (26+) right now. All you need is img { image-orientation: from-image }. I tested this in Firefox and it gives good results. It is not, however, implemented in any other browser and it seems to have been removed from latest CSS 4 drafts. Those drafts do, however that:

If the image has an orientation specified in its metadata, such as EXIF, the UA must rotate or flip the image to correctly orient it as the metadata specifies.

So CSS4-compatible browsers should, in theory, rotate images appropriately natively. That is not implemented anywhere, except in Firefox if you have that special (now) non-standard property. There's an issue opened in Chromium about this, but it's been opened for 5 years now and proposed patches have not been merged.

Considering that such a major browser hasn't implemented this, i would seriously consider doing this server-side instead.