When using “allow editing” there is a small box that one can massage the captured image into. It’s horizontal (always), and a vertical image won’t scale to fit in it.
If you don’t turn allow editing on, you get an image that is rotated, but I can’t see the logical way to detect it.
What are best practices here?
I’d like to be able to get a full, unscaled, image, but without understanding the orientation I fit it the wrong way, and with incorrect scaling of horizontal vs vertical sides (sometimes…)
Thank you, this appears to work.
For anyone else interested in this, do note that the code as posted has “AllowEditing” turned on, and that seems to manage the rotation for you. Turn it off, however, and Jeremie’s code does as is expected.
Thanks again, Jeremie.
You’re welcome, thanks for testing.
I happened to have the same issue in two of my apps and postponed the implementation and testing of the code I shared last night.
well oh joy… what works on the simulator is not working the same way on a real device…
Back to the drawing board!
When you test the image orientation of a picture taken with the camera, it’s always 0=up.
The problem is your device may have taken it in any number of it’s own orientations = top to the left is the only one that returns the image right tin Xojo.
Unfortunately when you test the device orientation it is not always the same as when you took the picture. For example if you have a portrait only app and take a picture by rotating landscape, the app shows you the image to accept or reject, and you’ll likely rotate the phone to see it right. If you then tap Use Photo your app will report the device in portrait up.
I can’t see any way around this now other than to use allow editing, which doesn’t give you access to the entire image.
In one of my apps I display a rotate button right after a picture is selected by the user.
Would that help?
Yes it will. I was thinking the same.
I’m back on this issue.
The fix Jeremie supplied is not holding up. Again I’m seeing images come in rotated, but Xojo is reporting the width vs height backwards.
Has anyone else tacked this yet?
I can always use the “AllowEditing” option, but that makes it really hard to get the cropping desired in many images.
I don’t understand why, when AllowEditing is on, we cannot move the image up. I can shove it down to the point where there is black, non-image at the top, but I cannot move to allow the bottom of the image to move to the bottom of the window selection area.
Is there a way to work around this?