Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): add rotation to blob #13715

Merged
merged 11 commits into from
Aug 19, 2023
Merged

feat(android): add rotation to blob #13715

merged 11 commits into from
Aug 19, 2023

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jan 12, 2023

Adding a rotation value to Ti.Blob. If it is available in the blob it will return it:

const win = Ti.UI.createWindow({layout:"vertical"});
const btn1 = Ti.UI.createButton({title:"1"})
const btn2 = Ti.UI.createButton({title:"2"})
const btn3 = Ti.UI.createButton({title:"3"})
win.add([btn1,btn2,btn3]);

btn1.addEventListener("click", function() {
	Ti.Media.openPhotoGallery({
		success: function(e) {
			console.log(e.media.rotation);
			console.log(e.media.width, "x", e.media.height);
			console.log(e.media.uprightWidth, "x", e.media.uprightHeight);
		}
	});
})
btn2.addEventListener("click", function() {
	Ti.Media.showCamera({
		success: function(e) {
			console.log(e.media.rotation);
			console.log(e.media.width, "x", e.media.height);
			console.log(e.media.uprightWidth, "x", e.media.uprightHeight);
		}
	});
})
btn3.addEventListener("click", function() {
  var file  = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'test.txt');
  console.log(file.read().rotation);
})
win.open();

Test:

  • run the app (manually allow Camera permission!)
  • click 1, select an image. Should most of the time return 0
  • click 2, make an image in portrait or landscape mode and it should return a rotation value
  • click 3, it should return undefined

Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! APPROVED

@cb1kenobi cb1kenobi merged commit 8d51e09 into master Aug 19, 2023
7 checks passed
@m1ga m1ga deleted the 230112_media_orientation branch September 23, 2023 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants