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);
        }
示例#2
0
 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);
 }
示例#3
0
 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));
        }
示例#5
0
        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));
        }