public void OnPickGalleryImage() { // Whether to generate thumbnails var shouldGenerateThumbnails = true; // if image is larger it will be downscaled to the max size proportionally var imageResultSize = ImageResultSize.Max512; AGGallery.PickImageFromGallery( selectedImage => { var imageTexture2D = selectedImage.LoadTexture2D(); string msg = string.Format("{0} was loaded from gallery with size {1}x{2}", selectedImage.OriginalPath, imageTexture2D.width, imageTexture2D.height); AGUIMisc.ShowToast(msg); Debug.Log(msg); image.sprite = SpriteFromTex2D(imageTexture2D); // Clean up Resources.UnloadUnusedAssets(); }, errorMessage => AGUIMisc.ShowToast("Cancelled picking image from gallery: " + errorMessage), imageResultSize, shouldGenerateThumbnails); }
public void Screenshot() { var imageTitle = "Screenshot-" + System.DateTime.Now.ToString("yy-MM-dd-hh-mm-ss"); const string folderName = "com.javifont.camera"; AGGallery.SaveImageToGallery(imageToGallery, imageTitle, folderName, ImageFormat.JPEG); AGUIMisc.ShowToast("Image saved in the gallery", AGUIMisc.ToastLength.Long); }
public static void SavePhoto(Texture2D texture) { #if UNITY_IOS IGImagePicker.SaveImageToGallery(texture); #elif UNITY_ANDROID string imageTitle = "mcm house ar " + System.DateTime.Now.ToString("yy-MM-dd-hh-mm-ss"); const string folderName = "mcm house ar screenshots"; AGGallery.SaveImageToGallery(texture, imageTitle, folderName, ImageFormat.JPEG); #endif }
public void OnPickGalleryImage() { AGGallery.PickImageFromGallery( selectedImage => { AGUIMisc.ShowToast(string.Format("{0} was loaded from gallery with size {1}x{2}", selectedImage.FileName, selectedImage.Image.width, selectedImage.Image.height)); image.sprite = SpriteFromTex2D(selectedImage.Image); }, () => AGUIMisc.ShowToast("Cancelled picking image from gallery"), ImageFormat.JPEG, ImageResultSize.Max1024); }
public void OnGetImageExifTags() { if (_imageFilePath == null) { AGGallery.PickImageFromGallery( selectedImage => { GetImageTags(selectedImage.OriginalPath); Resources.UnloadUnusedAssets(); }, errorMessage => AGUIMisc.ShowToast("Cancelled picking image from gallery: " + errorMessage)); } else { GetImageTags(_imageFilePath); } }
public void OnSetWallpaperFromFilePath() { AGGallery.PickImageFromGallery( selectedImage => { var imageTexture2D = selectedImage.LoadTexture2D(); string msg = string.Format("{0} was loaded from gallery with size {1}x{2}", selectedImage.OriginalPath, imageTexture2D.width, imageTexture2D.height); AGUIMisc.ShowToast(msg); Debug.Log(msg); AGWallpaperManager.SetWallpaper(selectedImage.OriginalPath); // Clean up Resources.UnloadUnusedAssets(); }, errorMessage => AGUIMisc.ShowToast("Cancelled picking image from gallery: " + errorMessage)); }
public void OnSetImageExifTags() { //Note, that PickImageFromGallery creates a duplicate of the selected image in the application folder //This is why you need to store the path to it, so you can later get it or its attributes AGGallery.PickImageFromGallery( selectedImage => { _imageFilePath = selectedImage.OriginalPath; var exif = new AGExifInterface(_imageFilePath) { Artist = "Osiris" }; Debug.Log("Artist: " + exif.Artist); exif.SaveAttributes(); Resources.UnloadUnusedAssets(); }, errorMessage => AGUIMisc.ShowToast("Cancelled picking image from gallery: " + errorMessage)); }
public void OnPickGalleryImageError(string message) { AGGallery.OnErrorTrigger(message); }
// These are invoked from Java by UnityPlayer.UnitySendMessage #region picker_callbacks public void OnPickGalleryImageSuccess(string message) { AGGallery.OnSuccessTrigger(message); }