【问题标题】:Is it possible to use actual image from Phonegap plugin Canvas2Image?是否可以使用 Phonegap 插件 Canvas2Image 中的实际图像?
【发布时间】:2014-08-08 10:41:49
【问题描述】:

我正在使用Phonegap插件Canvas2Image:https://github.com/devgeeks/Canvas2ImagePlugin,我想知道是否可以在回调中获取渲染图像?

我正在使用他们文档中的代码:

window.canvas2ImagePlugin.saveImageDataToLibrary(
        function(msg){
            console.log(msg);
        },
        function(err){
            console.log(err);
        },
        document.getElementById('myCanvas')
    );

这非常适合按预期保存到库中,但是如果我想使用实际的 photo.png 或生成的任何内容,我可以这样做吗?如果没有,回调中是否有办法获取图像的本地文件系统 URL?

【问题讨论】:

    标签: javascript cordova


    【解决方案1】:

    参数中带有 msg 的第一个函数将是您的文件 URL。但是,它只是在 android 上回调。 IOS此时不工作。在 github 网站上,关于此事有一个未解决的问题。我还没有验证,但有人说iPhone: How do I get the file path of an image saved with UIImageWriteToSavedPhotosAlbum()? 有助于解决问题。

    Github 问题:https://github.com/devgeeks/Canvas2ImagePlugin/issues/38

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-01
    • 1970-01-01
    • 2016-10-06
    • 2014-11-03
    • 1970-01-01
    • 1970-01-01
    • 2013-01-25
    • 1970-01-01
    相关资源
    最近更新 更多