public override void SaveImageToGallery (byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { base.SaveImageToGallery(_imageByteArray, _onCompletion); if (_imageByteArray != null) saveImageToGallery(_imageByteArray, _imageByteArray.Length); }
public override void SaveImageToGallery (byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { base.SaveImageToGallery(_imageByteArray, _onCompletion); if (_imageByteArray != null) Plugin.Call(Native.Methods.SAVE_IMAGE_TO_GALLERY, _imageByteArray, _imageByteArray.Length); }
/// <summary> /// Saves the screenshot to gallery/media library of the users device. /// </summary> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public void SaveScreenshotToGallery(SaveImageToGalleryCompletion _onCompletion) { // First capture screenshot StartCoroutine(TextureExtensions.TakeScreenshot((_texture) => { // Now save it SaveImageToGallery(_texture, _onCompletion); })); }
public override void SaveImageToGallery(byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { base.SaveImageToGallery(_imageByteArray, _onCompletion); if (_imageByteArray != null) { Plugin.Call(NativeInfo.Methods.SAVE_IMAGE_TO_GALLERY, _imageByteArray, _imageByteArray.Length); } }
public override void SaveImageToGallery(byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { base.SaveImageToGallery(_imageByteArray, _onCompletion); if (_imageByteArray != null) { Plugin.Call(Native.Methods.SAVE_IMAGE_TO_GALLERY, _imageByteArray, _imageByteArray.Length, NPSettings.MediaLibrary.Android.SaveGalleryImagesToAppSpecificFolder); } }
public override void SaveImageToGallery(byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { base.SaveImageToGallery(_imageByteArray, _onCompletion); if (_imageByteArray != null) { saveImageToGallery(_imageByteArray, _imageByteArray.Length); } }
/// <summary> /// Saves the screenshot to gallery/media library of the users device. /// </summary> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public void SaveScreenshotToGallery (SaveImageToGalleryCompletion _onCompletion) { // First capture screenshot StartCoroutine(TextureExtensions.TakeScreenshot((_texture)=>{ // Now save it SaveImageToGallery(_texture, _onCompletion); })); }
/// <summary> /// Saves the specified image data source to gallery. /// </summary> /// <param name="_imageByteArray">image byte array to use as source.</param> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public virtual void SaveImageToGallery(byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { // Cache callback OnSaveImageToGalleryFinished = _onCompletion; if (_imageByteArray == null) { Console.LogError(Constants.kDebugTag, "[MediaLibrary] Saving image to album failed, texture data is null"); SaveImageToGalleryFinished(false); return; } }
/// <summary> /// Saves the specified texture to gallery. /// </summary> /// <param name="_texture">Texture that needs to be saved to gallery.</param> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public void SaveImageToGallery(Texture2D _texture, SaveImageToGalleryCompletion _onCompletion) { byte[] _imageByteArray = null; // Convert texture to byte array if (_texture != null) { _imageByteArray = _texture.EncodeToPNG(); } // Use api to save SaveImageToGallery(_imageByteArray, _onCompletion); }
public override void SaveImageToGallery(byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { base.SaveImageToGallery(_imageByteArray, _onCompletion); if (_imageByteArray != null) { // Feature isnt supported Console.LogError(Constants.kDebugTag, Constants.kErrorMessage); // Associated error event is raised SaveImageToGalleryFinished(false); } }
public override void SaveImageToGallery (byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { base.SaveImageToGallery(_imageByteArray, _onCompletion); if (_imageByteArray != null) { // Feature isnt supported Console.LogError(Constants.kDebugTag, Constants.kErrorMessage); // Associated error event is raised SaveImageToGalleryFinished(false); } }
/// <summary> /// Saves an image from the specified url to gallery/media library of the users device. /// \note The path needs to be absolute path if its local file. Take care of the path on multiple platforms as the file structure will be different. /// </summary> /// <param name="_URL">URL to pick the source from. This can be a file url existing on local storage or a web url at remote location.</param> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public void SaveImageToGallery(URL _URL, SaveImageToGalleryCompletion _onCompletion) { // Download texture from given URL DownloadTexture _newDownload = new DownloadTexture(_URL, true, false); _newDownload.OnCompletion = (Texture2D _texture, string _error) => { // Save downloaded texture if (!string.IsNullOrEmpty(_error)) { Console.LogError(Constants.kDebugTag, "[MediaLibrary] Texture download failed, URL=" + _URL.URLString); } // Save image SaveImageToGallery(_texture, _onCompletion); }; // Start download _newDownload.StartRequest(); }
/// <summary> /// Saves an image from the specified url to gallery/media library of the users device. /// \note The path needs to be absolute path if its local file. Take care of the path on multiple platforms as the file structure will be different. /// </summary> /// <param name="_URL">URL to pick the source from. This can be a file url existing on local storage or a web url at remote location.</param> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public void SaveImageToGallery (URL _URL, SaveImageToGalleryCompletion _onCompletion) { // Download texture from given URL DownloadTexture _newDownload = new DownloadTexture(_URL, true, false); _newDownload.OnCompletion = (Texture2D _texture, string _error)=>{ // Save downloaded texture if (!string.IsNullOrEmpty(_error)) { Console.LogError(Constants.kDebugTag, "[MediaLibrary] Texture download failed, URL=" + _URL.URLString); } // Save image SaveImageToGallery(_texture, _onCompletion); }; // Start download _newDownload.StartRequest(); }
/// <summary> /// Saves the specified image data source to gallery. /// </summary> /// <param name="_imageByteArray">image byte array to use as source.</param> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public virtual void SaveImageToGallery (byte[] _imageByteArray, SaveImageToGalleryCompletion _onCompletion) { // Cache callback OnSaveImageToGalleryFinished = _onCompletion; if (_imageByteArray == null) { Console.LogError(Constants.kDebugTag, "[MediaLibrary] Saving image to album failed, texture data is null"); SaveImageToGalleryFinished(false); return; } }
/// <summary> /// Saves the specified texture to gallery. /// </summary> /// <param name="_texture">Texture that needs to be saved to gallery.</param> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public void SaveImageToGallery (Texture2D _texture, SaveImageToGalleryCompletion _onCompletion) { byte[] _imageByteArray = null; // Convert texture to byte array if (_texture != null) { _imageByteArray = _texture.EncodeToPNG(); } // Use api to save SaveImageToGallery(_imageByteArray, _onCompletion); }