public async Task Post() { var b64photo = new StreamReader(Request.Body).ReadToEnd(); var client = GetDocClient(); var documentUri = UriFactory.CreateDocumentCollectionUri("TeamTrae", "Photos"); var photodata = Convert.FromBase64String(b64photo); var webphoto = RotateAndScale(photodata, out GeoLoc loc); var tnow = loc?.Timestamp ?? DateTime.Now; var isKeyFrame = SetAsKeyFrame(tnow); TTPhoto photo = new TTPhoto() { Id = tnow.ToString("yyyy_MM_dd_HH_mm_ss_", CultureInfo.InvariantCulture) + Guid.NewGuid().ToString(), Timestamp = tnow, // PhotoData = b64photo, LocationLat = loc?.Latitude ?? 0.0, LocationLong = loc?.Longitude ?? 0.0, // WebPhotoData = webphoto, IsKeyFrame = isKeyFrame }; try { await UploadBlob("originals", photo.Id, photodata); await UploadBlob("scaled", photo.Id, webphoto); var resp = await client.CreateDocumentAsync(documentUri, photo); } catch { // I died?! } }
public string GetPhotoCoord(TTPhoto photo) { return($"{photo.LocationLat.ToString(System.Globalization.CultureInfo.InvariantCulture)}, {photo.LocationLong.ToString(System.Globalization.CultureInfo.InvariantCulture)}"); }