3

i'm trying the Sencha Touch Camera API( http://docs.sencha.com/touch/2.3.1/#!/api/Ext.device.Camera) for taking pictures in a mobile device. Following the documentation instructions, now i'm able to capture the image in a base64 format, what is great. However, when the photo is taken in portrait orientation, it comes rotated by 90 degrees. This doesn't happen when the photo is taken in landscape orientation.

I suppose i can deal with this just by rotating the image. However, first i need to know what orientation was used.

What is the best way for doing this in Sencha Touch? I read that i could get the EXIF information using this, but looks like i can't access EXIF class.

Community
  • 1
  • 1
Pedro Alves
  • 1,667
  • 4
  • 17
  • 37
  • 1
    The Phonegap camera API camera.getPicture function supports a correctOrientation property that will solve this. The Sencha Touch API does not include this option. You might consider including this property by overriding the Ext.device.camera.Sencha class – Jeff Martin May 18 '14 at 23:36

1 Answers1

3

You could modify Ext.device.camera.Cordova passing in the correctOrientation property.

if ('correctOrientation' in args) {
    options.correctOrientation = args.correctOrientation;
}

Then you can pass the correctOrientation property directly to the capture() method.

It would be nice not to modify Sencha Touch sources, to prevent losing customizations when upgrading, so I would suggest you to extend the Ext.device.Camera singleton to use your Ext.device.camera.Custom.

Andrea Casaccia
  • 4,802
  • 4
  • 29
  • 54
  • 1
    I can't believe this is the only option we have. No one take photos using Sencha Touch or Cordova? No one else have problems with orientation? This is very weird. – Pedro Alves May 23 '14 at 17:39
  • 1
    I am taking photos in hybrid apps without bothering using Sencha's camera class, I guess you could just use directly Cordova's API, and you wouldn't lose much. – Andrea Casaccia May 23 '14 at 17:51
  • Yeah. I think this may be best solution. Forget Sencha's camera class. Thank you very much Anubis =) – Pedro Alves May 23 '14 at 18:03