This support forum is no longer in use. Please use the Cloudinary Community at https://community.cloudinary.com/ to receive assistance from other members of the community and from Cloudinary's support team. For account-specific questions or if you believe that you've encountered a bug, please contact the Cloudinary team directly via the "submit a request" option on this support site.

How to get all images from cloudinary and display them in my web page ?

Comments

3 comments

  • Avatar
    Loic Verger Del Bove

    Hi,

    You should be able to do this by using the Search API to list all the images URL in your `LostDocs` folder and then display it on your second page. Here is a script that will list all the URLs and put them in an array:

    var result = [];

    var options = { resource_type:"image", folder:"your_folder", max_results: 500};

    function listResources(next_cursor) {
    if(next_cursor) {
    options["next_cursor"] = next_cursor;
    }
    console.log(options);
    cloudinary.api.resources(options, function(error,res){
    if (error) {
    console.log(error);
    }
    var more = res.next_cursor;
    resources = res.resources;

    for(var res in resources) {
    res = resources[res];
    var resultTemp = [];
    var url = res.secure_url;
    resultTemp.push(url);
    result.push(resultTemp);
    }

    if (more) {listResources(more);}
    else {console.log("done");}
    });
    }
    listResources(null);

    Best,

    Loic

    1
    Comment actions Permalink
  • Avatar
    yuoenss assrear

    Thank you for answering my question !

    Now, how can i integrate those results into my html page ? Do i have to use a template engine like ejs ?

    the script you provided works fine but only answer my question partly.

    thanks again 

    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi there,

    Since you have the list of URL on the backend, you can now either use a template engine (on my side I use pug) or not to render the images but in any case, you will need to loop through this list and create an `img` element for each URL. 

    Hope that helps.

    Best,

    Loic

    0
    Comment actions Permalink

Post is closed for comments.