Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(android): return and store exif data in blob/file #14074

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jul 2, 2024

Two new features:

  • get exif data in event.media.exif from the camera media file
  • it will also be store into a file when you run imageAsCompressed and write that blob data
var win = Ti.UI.createWindow();

win.addEventListener("click", function() {
	Ti.Media.showCamera({
		success: function(event) {
			console.log(event.media.exif)

			var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory + "/image.jpg");
			f.write(event.media);

			var f1 = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory + "/image1.jpg");
			f1.write(event.media.imageAsCompressed(0.9));

			var f1 = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory + "/image2.jpg");
			f1.write(event.media.imageAsCropped({
				width: 10,
				height: 10,
				x: 0,
				y: 0
			}));

			var f1 = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory + "/image3.jpg");
			f1.write(event.media.imageAsResized(20, 20));

		}
	});
})

win.open();

Test
12.3.1:

  • run the above code in Ti 12.3.1 and download the two files from your phone
  • image1.jpg won't have any exif data

With this PR:

  • image1.jpg, image2.jpg and image3.jpg will have exif data
  • you will see a console.log with the exif data from the camera image

@m1ga m1ga marked this pull request as ready for review December 14, 2024 15:52
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant