Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Image Orientation (media.selectphoto)
Started by farjadfarabi_czs Jan 29 2016 08:53 PM

1 reply to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

farjadfarabi_czs

[GLOBAL: userInfoPane.html]
farjadfarabi_czs
  • Enthusiast

  • 97 posts
  • Corona SDK

Hello guys,

 

I was wondering is there any way to detect the orientation property of an image retrieved using media.selectphoto ? 

On iOS every image is 4:3 aspect ratio. If I understand correctly, portrait images are rotated by 90 degrees.

 

When the image is shown on screen, the OS rotates it back to upright position. 

 

So is there any way to know whether the image is in portrait or landscape mode? I tried using contentwidth and contentheight to no avail because both portrait and landscape images are stored using same width x height, unless I am missing something ?

 

Any help is appreciated, Thank you. 



[TOPIC: post.html]
#2

farjadfarabi_czs

[GLOBAL: userInfoPane.html]
farjadfarabi_czs
  • Enthusiast

  • 97 posts
  • Corona SDK

I guess I will answer myself here haha. It seems there was something wrong in my own code. In fact the media API returns the Image in the right orientation, whether portrait or landscape. You can use event.target.height /width to determine what orientation it is in. 




[topic_controls]
[/topic_controls]