retrieve an image from an iPhone folder

Asked 2 years ago, Updated 2 years ago, 69 views

I'd like to add a photo-taking function in the template of the ToDo app to select photos in the iPhone folder.

function addToPicture(){
    navigator.camera.getPicture(addTodo, function(){
        alert("Failed to get camera.");
    }, {
        quality —50,
        destinationType:Camera.DestinationType.FILE_URI,
        targetWidth: 100,
        targetHeight: 100
    });
}
function addTodo(camera_url){
    var title=$("#todo-title").val();
    var body=$("#todo-body").val();
    varimg_tag="";
    if(camera_url){
        img_tag="<img src='"+camera_url+"'>";
    }
    $.mobile.changePage($("#list-page"));
    $("#todo-list").append("<li>"+img_tag+"<h3>"+title+"</h3>p>"+body+"</p>li>")
    $("#todo-list").listview('refresh');
};

How do I incorporate Camera.PictureSourceType.PHOTOLIBRARY into this template?

monaca api

2022-09-30 19:06

1 Answers

< p > and albums as to make his own branch to selection out of photography and < / > 選択処理自体はここ(Monaca Docs)の「Obtain Pictures from a Device’s Album」に書いてあるコードをコピペしてcallbackの部分だけ変更すればいけませんか?
* just in the debugger is confirming selection to the point when the pictures. < / >

function getPhoto(){
  // Specify the source to get the photos.
  navigator.camera.getPicture(onSuccess, onFail, 
    { quality:50, destinationType:Camera.DestinationType.FILE_URI,
    sourceType:navigator.camera.PictureSourceType.SAVEDPHOTOALBUM});
}


2022-09-30 19:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.