Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14950

Android: Implement a way to retrieve image's orientation after taking photo or picking from gallery

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      Android 4.1.2, SDK 3.1.1GA, Samsung Nexus S

      Description

      In some devices, when you take a photo or pick it from gallery, if the image's orientation is landscape, but Titanium shows it in portrait.

      I know that a workaround has been implemented to prevent Titanium to ignore the image's default orientation, described here:
      https://jira.appcelerator.org/browse/TIMOB-3887

      This is good for displaying the image (if you let the height or the width auto), but still, there is no way to get the image's default orientation, or knowing if it was rotated or not.

      I need to display every image in a 3:4 view, for uploading the image.
      If the image is taken in portrait mode, no problem, I can just display it, and let the user choose to retake or upload.

      But if the image is landscape, what should I do is cut the sides to make it fit in the area. The "autorotate" attribute solves the problem of displaying it right, but since there is no way to know the image's orientation, the image appears shrinked.

      Code to reproduce:

      Ti.Media.openPhotoGallery({
      	success : function(event) {
      		var newWin = Ti.UI.createWindow({
      			navBarHidden:true,
      			width:'100%',
      			height:'100%'
      		});
      		var img = Ti.UI.createImageView({
      			image:event.media,
      			height:4/3*Ti.Platform.displayCaps.platformWidth, //forcing the 3:4 aspect ratio
      			width:Ti.Platform.displayCaps.platformWidth,
      			autorotate:true,
      		});
      		
      		newWin.add(img);
      		newWin.open();
      	},
      	cancel:function() {},
      	error:function(error) {},
      	mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]
      });
      

      To sum up:
      There should be a way not only to display the image on it's default oritation, but also to know the default orientation.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emerriman Eric Merriman
                Reporter:
                andreperazzi André Perazzi
              • Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration