kartoteket / vue-image-upload-resize

A simple vue-component for client-side image upload with resizing
MIT License
175 stars 54 forks source link

Replace exif.js with exifr library #49

Closed bbugh closed 4 years ago

bbugh commented 4 years ago

This is a partial implementation to get started to fix #36. I don't know if it's necessary, because it doesn't seem to fix #41, which is why I was trying to make this PR. Our users take a lot of landscape images and it doesn't seem to be automatically rotating anymore.

Notes:

MikeKovarik commented 4 years ago

Hello.

I'm sorry, I can't be of much help to you right now since I'm on a vacation. But from the look at the PR it looks good.

Full package / base64: You could maybe try to go the build-your-own package route and import only the file readers and metadata parsers you need. There's an info about it in the Advanced API section, modularity subsection.

Orientation / rotation: aha. So exifr has some neat autorotation logic in the highlevel-api.mjs that you can't use directly but you can still take a look at it and copy-paste it. Or I could move it into a utility function and expose it so you can use it even after doing exifr.parse. btw. Also check out https://mutiny.cz/exifr/examples/orientation.html

bbugh commented 4 years ago

Nevermind, exifr fatally errors on PNG and WEBP files.

vsirghii commented 3 years ago

Hey @bbugh and @svale, exif.js reads exif data from the image and acts accordingly. The thing is that exif data is available on .jpg and .tiff images only (from exif docs). So image types like .png, .gif etc. won't comply here. That's why probably exifr is no much difference with exif, and you haven't seen fixes for #41. Correct me please if I'm wrong about this???