New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-mz-img-to-gallery

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-mz-img-to-gallery

Cordova plugin to save base64 data as a png image into the device

  • 4.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Cordova ImgToGallery Plugin

============================ forked from Nexxa/cordova-base64-to-gallery

SetUp

cordova plugin add cordova-plugin-mz-img-to-gallery

Usage

function getBase64Image(img) {
    var canvas = document.createElement("canvas");
    canvas.width = img.width;
    canvas.height = img.height;
    var ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0, img.width, img.height);
    var dataURL = canvas.toDataURL("image/png");
    return dataURL;
}
var tempImage = new Image();
tempImage.src = "https://图片地址"
tempImage.crossOrigin = "*";
tempImage.onload = function()
{
    var base64Data = getBase64Image(tempImage);
    cordova.base64ToGallery(base64Data,
        {
            prefix: 'cordova_', // 图片前缀
            mediaScanner: true // 保存成功通知相册刷新
        },
        function(path) {
            console.log("已保存到相册",path);
        },
        function(err) {
            console.error("savePhoto->保存失败:"+JSON.stringify(err),"error")
        }
    );
}

Keywords

FAQs

Package last updated on 19 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc