Get all images from specific folder

Gets all image files from specific folder. In this example, folder name is "Camera".
//Javascript

// Retrieve the ContentManager interface instance using the tizen global object
var manager = tizen.content;

// Let's try to retrieve the list.
var contentType = "IMAGE";
var filter = new tizen.AttributeFilter("type", "EXACTLY", contentType);
manager.find(mediaItemArray, onError, null, filter);

function onError(response) {
    console.log( "The following error occurred: " + response.name);
}

function mediaItemArray (contents) {
    console.log("Successfully retrieved the list of Image items");

    for (var i = 0; i < contents.length; i++) {
        if (contents[i].contentURI.indexOf("Camera") != -1) {
            console.log(i + ":"  + ":" + contents[i].title + ":" +contents[i].mimeType);
    	}
    }
}


// Requires the following Tizen Privileges:
// <tizen:privilege name="http://tizen.org/privilege/content.read"/>
// Add this lines to config.xml file

Responses

0 Replies