Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it work in the browser? #6

Open
selbekk opened this issue Apr 25, 2018 · 4 comments
Open

Does it work in the browser? #6

selbekk opened this issue Apr 25, 2018 · 4 comments

Comments

@selbekk
Copy link

selbekk commented Apr 25, 2018

I couldn't find a reference to it in the readme - does this lib work in the browser?

@johansatge
Copy link
Owner

johansatge commented Apr 25, 2018

Hi,

currently it does not unfortunately (it uses the jpeg-js module which is for nodejs only, I think)

(I'll clarify it in the readme, thanks for the feedback)

@selbekk
Copy link
Author

selbekk commented Apr 25, 2018

Thanks for the quick reply! Ah shucks - that's too bad.

@johansatge
Copy link
Owner

johansatge commented Apr 25, 2018

That would be great though!

Roughly, here is what would be needed to make it work:

  • Make sure piexifjs works in the browser
  • Make jpeg-js work in the browser (looks like there is an existing PR)
  • Make the jpeg-autorotate module compatible with both browser & node
    • Handle module.exports vs browser definition
    • Expose the source in a single file that can be embedded with jsDelivr or similar
  • Define how to give an image to the module when running in the browser (Blob, img tag from the DOM...) and implement it
  • Update the unit tests accordingly

Let's keep the issue opened. I'll try to dig if I find some time.

Of course, if someone reads this issue and is interested in working on the subject, pull requests are very welcome 👍

@xaphod
Copy link

xaphod commented Nov 11, 2020

IMO if you want to do it in the browser, consider a canvas-based approach. Here's one that looks decent: https://github.com/ajgarn/CanvasImageUploader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants