void OnCapturedPhotoToDisk(PhotoCapture.PhotoCaptureResult result) { if (result.success) { Debug.Log("Saved Photo to disk!"); photoCaptureObject.StopPhotoModeAsync(OnStoppedPhotoMode); Debug.Log("moving " + tempFilePathAndName + " to " + picturesFolder.Path + "\\Camera Roll\\" + tempFileName); File.Move(tempFilePathAndName, picturesFolder.Path + "\\Camera Roll\\" + tempFileName); Texture2D tex = null; byte[] fileData; if (File.Exists(picturesFolder.Path + "\\Camera Roll\\" + tempFileName)) { fileData = File.ReadAllBytes(picturesFolder.Path + "\\Camera Roll\\" + tempFileName); string base64 = Convert.ToBase64String(fileData); print(base64); //GameObject.Find("Canvas").transform.GetChild(0).gameObject.SetActive(true); //GameObject.Find("Canvas").transform.GetChild(1).gameObject.SetActive(true); LandmarkDetect landmarkScript = gameObject.GetComponent <LandmarkDetect>(); //PhotoCap3 and LandmarkDetect are on the same GameObject landmarkScript.detectImage(base64); //debug /*tex = new Texture2D(1920, 1080); * tex.LoadImage(fileData); * Renderer quadRenderer = gameObject.GetComponent<Renderer>(); * quadRenderer.material = new Material(Shader.Find("Standard")); //Custom/Unlit/UnlitTexture * quadRenderer.material.SetTexture("_MainTex", tex);*/ } } else { Debug.Log("Failed to save Photo to disk " + result.hResult + " " + result.resultType.ToString()); } }
public void fetchNews() { headers.Add("Ocp-Apim-Subscription-Key", "0cbbf65a0afc46ecb1daa8e8b6723e3e"); LandmarkDetect getLandmarkDetect = gameObject.GetComponent <LandmarkDetect>(); string landmarkCity = getLandmarkDetect.landmarkCity; string landmarkCountry = getLandmarkDetect.landmarkCountry; string landmarkCityUrl = "https://api.cognitive.microsoft.com/bing/v5.0/news/search?q=" + landmarkCity + "&count=5"; string landmarkCountryUrl = "https://api.cognitive.microsoft.com/bing/v5.0/news/search?q=" + landmarkCountry + "&count=5"; Debug.Log("landmarkCityUrl: " + landmarkCityUrl); Debug.Log("landmarCountryUrl: " + landmarkCountryUrl); WWW landmarkCitywww = new WWW(landmarkCityUrl, null, headers); WWW landmarkCountrywww = new WWW(landmarkCountryUrl, null, headers); string city = "City"; string country = "Country"; StartCoroutine(WaitForRequest(landmarkCitywww, city)); StartCoroutine(WaitForRequest(landmarkCountrywww, country)); // fetchDescriptionAndImage("https://api.cognitive.microsoft.com/api/v5/entities/3bd9e326-67e3-cb9d-57a5-63f0f59fa061", "https://www.bing.com/th?id=ON.D6DB36F5EE39FAF1B3F03A8B14A44765&pid=News"); }