-
Notifications
You must be signed in to change notification settings - Fork 369
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
The image is rotated in iPhone #123
Comments
Same problem here, hope to fix it. |
Just chiming in that I also have this issue. |
I try in two iPhone 6.
What version do you have? |
Rotated for me on iOS 10.2.1. Don’t think it’s an issue once rotate functionality is in. Relying on EXIF is not an option in all cases as it’s not 100% reliable. |
I'm not sure you'll see it reproduced in the simulator. It's rotated when taking a photo and uploading. |
I fixed this using https://github.com/blueimp/JavaScript-Load-Image
Where onDrop is setting state, used in the cropper. |
Besides EXIF detection not being substitutable to the rotation feature, the library @stolinski mentioned dedicates 300 lines of code to the task... Worth the trouble ? |
This is not really an issue with react-avatar-editor but rather an issue with mobile browsers when using your camera. In order to get around it, you need some way to parse the EXIF data, transform the image with a canvas based off of the Orientation, and then use the transformed image with react-avatar-editor. I used https://github.com/exif-js/exif-js and then I used http://chariotsolutions.com/blog/post/take-and-manipulate-photo-with-web-page/ and https://gist.github.com/ammulder/5120103 for reference. If JavaScript-Load-Image isn't working for somebody then I can publish an npm module with the minimum workaround. |
@stolinski can you explain how you ended up the JavaScript-Load-Image package in React? if I follow the package instructions and add the package as a script tag in index.html file, then I cannot use loadImage because it is undefined in my specific component. Also, I cannot import the package in my Component properly. Any quick tips would be greatly appreciated! when I try importing the package as a component, I get 'windows is not defined' as the error in the package because I am using server side rendering for react. @jljorgenson18 if you have a spare minute, can you explain your workaround in more detail? |
I figured out how to use Javascript-Load-Image. My problem was that my app is isomorphic. Since the window object was referenced in the package, the server code broke on compilation before it can be used in the client. I fixed it by adding the following in index.js file
|
By the way, for anyone else that came across this issue, I ended up not using Javascript-Load-Image for ex-if rotation in the browser. The reason is that if I wanted to the retain the original image size while rotating, in would drastically increase in size most of the time (from 2.9mb to 17mb). The alternatives that did work for me are both on server side:
In both cases the resulting images where close enough to the original size of the image and seem to work on the few test cases that I tried them. |
As rightly said above this is not a bug with this control, it happens with mobile browser. I was able to resolve this easily with npm package
The code can be viewed at: Happy to help if something is not clear |
I ran into this issue myself, created this Utils method in Typescript which was inspired by @innoist's suggestion. Does not require any external code.
Usage:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The image is rotated in iPhone either in Chrome or Safari. In Android is OK in PC is OK but in iPhone the image is auto rotated 90 grades.
The text was updated successfully, but these errors were encountered: