Details

    • Type: Improvement
    • Status: Closed
    • Resolution: Duplicate
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Description

      In Ti 9.1.0 there was a change to the orientation handling of rotated images:

      https://github.com/appcelerator/titanium_mobile/pull/11679

      https://github.com/appcelerator/titanium_mobile/blob/7ce3ae11f2c886864ed7713b1e88324b60fdf8f6/android/titanium/src/java/org/appcelerator/titanium/TiBlob.java#L756-L758

      while this fixes the rotation of the images in the example it brings some problems using av.imageview:
      https://github.com/AndreaVitale/av.imageview/issues/92

      One thing I see is that on my Android 10, Pixel 4 I always get the wrong orientation in e.media.width/height for portrait images when looking at images from camera or gallery but I don't know the orientation (e.g. a portrait image is exif orientation 6 (top, right) but the returned width value is higher).

      In my opinion the images that are returned to my app should always be in the correct orientation AND the width/height value should represent that too.

      var window = Ti.UI.createWindow({
      	title: "Image Test"
      });
       
      var AvImageview = require("av.imageview");
      var img1 =AvImageview.createImageView({
      	width: Ti.UI.FILL,
      	height: 200,
      	top: 0,
      	contentMode: AvImageview.CONTENT_MODE_ASPECT_FILL,
      });
       
      var img2 =AvImageview.createImageView({
      	width: Ti.UI.FILL,
      	height: 200,
      	top: 200,
      	contentMode: AvImageview.CONTENT_MODE_ASPECT_FILL,
      });
      var img3 =Ti.UI.createImageView({
      	width: Ti.UI.SIZE,
      	height: 200,
      	top: 400,
      	autoRotate: true
      });
      var img4 =Ti.UI.createImageView({
      	width: Ti.UI.SIZE,
      	height: 200,
      	top: 600,
      	autoRotate: true
      });
      window.add(img1);
      window.add(img2);
      window.add(img3);
      window.add(img4);
      var dl = Ti.UI.createButton({
      	title: "gal",
      	bottom: 60,
      });
      dl.addEventListener("click", function(e) {
      	Ti.Media.openPhotoGallery({
      		success: function(e) {
      			var w = e.media.width;
      			var h = e.media.height;
       
      			var r = h / w;
      			w = 1024;
      			h = r * w;
       
      			var imageBlob = e.media.imageAsResized(w, h);
      			img1.image = e.media;
      			img2.image = imageBlob;
      			img3.image = e.media;
      			img4.image = imageBlob;
      		}
      	});
      });
       
      window.add(dl);
      window.open();
      

      Needs av.imageview (https://github.com/AndreaVitale/av.imageview/releases/tag/Android-5.0.1)

      9.0.3.GA

      9.1.0.RC

      1st and 3rd image are straight from the Gallery
      2nd and 4th image are resized images.

        Attachments

        1. ti903ga.jpg
          360 kB
          Michael Gangolf
        2. ti910rc.jpg
          437 kB
          Michael Gangolf

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                michael Michael Gangolf
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Git Integration