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);
        }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
 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
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
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);
     }
 }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
0
 public void OnPickGalleryImageError(string message)
 {
     AGGallery.OnErrorTrigger(message);
 }
Exemplo n.º 9
0
        // These are invoked from Java by UnityPlayer.UnitySendMessage

        #region picker_callbacks

        public void OnPickGalleryImageSuccess(string message)
        {
            AGGallery.OnSuccessTrigger(message);
        }