PhoneGap的 - 机器人 - 如何从相机保存捕获图像中的SD卡 [英] PhoneGap - Android - how to save the capture image from camera in the sd card

查看:162
本文介绍了PhoneGap的 - 机器人 - 如何从相机保存捕获图像中的SD卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的PhoneGap的Andr​​oid开发者。我正在使用的PhoneGap在Android的应用程序。我想拍照的设备摄像头,然后我想,从设备和以及存储在SD卡中拍摄的图像拍摄后的图像在屏幕上显示。你能告诉我怎样才能做到这一点。

I'm new in PhoneGap Android developer. I'm making an application in android using the phonegap. I want to take picture from the device camera and then i want to display it on the screen after taking the image from device and as well as store that captured image in the SD Card. Can you please tell me how i can do this.

古尔$ P $宠物辛格

Gurpreet singh

推荐答案

有关节能的SD卡......

For saving in the SD card......

function save(){

    document.addEventListener("deviceready", onDeviceReady, false);
}



    // PhoneGap is ready
    //
    function onDeviceReady() {
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
    }

    function gotFS(fileSystem) {
        fileSystem.root.getFile("pic.jpg", {create: true, exclusive: false}, gotFileEntry, fail);
    }

    function gotFileEntry(fileEntry) {
        fileEntry.createWriter(gotFileWriter, fail);
    }

    function gotFileWriter(writer) {

        var photo = document.getElementById("image");
        writer.write(photo.value);

    }

    function fail(error) {
        console.log(error.code);
    }

这篇关于PhoneGap的 - 机器人 - 如何从相机保存捕获图像中的SD卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆