Code example for ExifInterface

Methods: getAttribute, hasThumbnail

0
	 
	@Kroll.method 
	public KrollDict getExifData(String fileName)
	{ 
		try { 
			ExifInterface exif = new ExifInterface(fileName);
			 
			HashMap<String, String> tag = new HashMap<String, String>();
			 
			tag.put("hasThumbnail", exif.hasThumbnail() ? "true" : null);
			tag.put("height", exif.getAttribute("ImageLength"));
			tag.put("width", exif.getAttribute("ImageWidth"));
			tag.put("alt", exif.getAttribute("GPSAltitude"));
			tag.put("altRef", exif.getAttribute("GPSAltitudeRef"));
			tag.put("lat", exif.getAttribute("GPSLatitude"));
			tag.put("latRef", exif.getAttribute("GPSLatitudeRef"));
			tag.put("lon", exif.getAttribute("GPSLongitude"));
			tag.put("lonRef", exif.getAttribute("GPSLongitudeRef"));
			tag.put("date", exif.getAttribute("GPSDateStamp"));
			tag.put("time", exif.getAttribute("GPSTimeStamp"));
 
			return new KrollDict(tag);//new JSONObject(tag).toString();
		} 
		catch(Exception e){
			return null;