Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7092105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:16:18+00:00 2026-05-28T08:16:18+00:00

var pictureSource; // picture source var destinationType; // sets the format of returned value

  • 0

    var pictureSource;   // picture source
    var destinationType; // sets the format of returned value 
    var photoid=window.localStorage.getItem("photoid");
    var photoData=null;
    // Wait for PhoneGap to connect with the device
    //
    document.addEventListener("deviceready",onDeviceReady,false);

    // PhoneGap is ready to be used!
    //
    function onDeviceReady() {
        pictureSource=navigator.camera.PictureSourceType;
        destinationType=navigator.camera.DestinationType;

    }

    // A button will call this function
    //
    function getPhoto(source) {
        alert("Entered sd card");
        // Retrieve image file location from specified source
        navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, 
                                    destinationType: destinationType.FILE_URI,
                                    sourceType: source });
    }

    function onPhotoDataSuccess(imageData) {
         console.log(imageData);

        // Get image handle
        var smallImage = document.getElementById('photos');

        // Unhide image elements
        //
        smallImage.style.display = 'block';

        // Show the captured photo
        // The inline CSS rules are used to resize the image
        //
        smallImage.src = "data:image/jpeg;base64," + imageData;
        alert(imageData);
        photoData = imageData;
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
    }

    function gotFS(fileSystem) {
        fileSystem.root.getFile("/sdcard/external_sd/"+photoid+".jpg", null, gotFileEntry, fail);
    }

    function gotFileWriter(writer) {
        writer.onwrite = function(evt) {
            alert("write success");
        };
        writer.write(photoData);
    }

    function fail(error) {
        alert(error.code);
    }


    /*   function onPhotoURISuccess(imageURI) {
        // Uncomment to view the image file URI 
         console.log(imageURI);
        alert("photo captured");
        uploadPhoto(imageURI);
    } */

    /*  function getPhoto(source) {
        // Retrieve image file location from specified source
        navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, 
                                    destinationType: destinationType,
                                    sourceType: source });
    } */

    // Called if something bad happens.
    // 
    function onFail(message) {
        alert('Failed because: ' + message);
    }

I have used the above code to access data in the sd card. But now what i need to do is, get the path of the images present there and put it in a diff object that can access the path and display those images. I have no clue on how to go about that.
Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:16:19+00:00Added an answer on May 28, 2026 at 8:16 am

    What you can do is write a phonegap plugin for the platform you are developing for. I’ll assume it’s android. Writing android plugins.
    When you call the Phonegap.exec to call the plugin, the plugin, gets the sd card path through

    Environment.getExternalStorageDirectory().getAbsolutePath()
    

    and then does a basic search to get all the .jpg and .png files and return a json of all the paths of the files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

var q = from child in doc.Descendants(level) where (int)child.Attribute(id) == 55 select (string)child.Element(Points).**Value.ToString()**; I
var input; // method 1 input = document.getElementById('address').value; alert(input) // method 2 eval('input =
var allRapidSpells = $$('input[value^=RSW]'); Can anyone tell me what that does?
var idParam = new SQLiteParameter(@idParam, SqlDbType.Text) { Value = insertData.ID }; var userIdParam =
var getAllProducts = _productService.GetAllProducts(); if (productstest.Count > 0) { model.idproduct.Add(new SelectListItem() { Value =
var theNewWindow = window.open('http://www.example.com', 'example', ''); How can I use the document object of
var $page = el.parents('div[data-role=page]:visible'); Being called on pageinit() is showing null for me. Does
var arr = [{ key: key1, value: z }, { key: key2, value: u
var i : integer; i := 1234567; Given the above, I want the string
var y = new w(); var x = y.z; y.z= function() { doOneThing(); x();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.