Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

napych/cordova-plugin-downloadimage-to-gallery

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-downloadimage-to-gallery

The cordova plugin for downloading image into android and iphone photos gallery.

Supported platforms

  • Android
  • iOS

Installation

cordova plugin add https://github.com/saisreeharsha/cordova-plugin-downloadimage-to-gallery

or

cordova plugin add cordova-plugin-downloadimage-to-gallery

Methods:

-Android & IOS

    download(url,onsuccess,onerror)  //'url' can be any online resource url or dataURI
  • IOS Only
    downloadWithLocalPath(relativeUrl,onsuccess,onerror) //'relativeUrl' relative to Library/NoCloud  e.g. "/myimage/logo.png"

Usage

Android & IOS

  1. Download from a url when device is ready
document.addEventListener("deviceready", onDeviceReady);

onDeviceReady = function () {
  window.DownloadImageToGallery.download(
    "http://cordova.apache.org/static/img/cordova_bot.png",
    function success() {
      alert("Image downloaded successfully");
    },
    function failure() {
      alert("Image download failed");
    }
  );
};

(IOS only)

2.download a local image file: *If you have a file inside your app's dataDirectory(/Library/NoCloud/) and the path is /Library/NoCloud/myImages/logo.png, then you can move it to image gallery using the following code snippit

  document.addEventListener("deviceready",onDeviceReady);

  onDeviceReady = function(){
      window.DownloadImageToGallery.downloadWithLocalPath("/myImages/logo.png",function(){
          alert("success");
      },function(){
          alert("error");
      });
  }

License

Apache License 2.0

About

The cordova plugin for downloading image from url into gallery.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 51.3%
  • Objective-C 41.0%
  • JavaScript 7.7%