How to get all the files in a folder for the GALLERIA?

pending (12 posts) (4 voices)

  1. Victorross
    Member

    Hi! This is my first post, i am victor form argentina, i am looking for the php solution that let me list all the files in a folder (i need it for the images) i am working with a lot of photos and it will be a waste of time to put one by one the FULL URL just to make the galleria.
    I can upload all the photos to differnt folders in my host, and then i would like to put the FOLDER URL just to get the GALLERIA, i think it will be very easy that way.

    http://www.portalcorrientes.com/2010/12/24/hello-world/
    This is the post wich i am working on, first you can see the wordpress default gallery, then in the end i try tu put a galleria with this code: [code][galleria transition="fade" height="300" width="600" autoplay="false"]http://www.portalcorrientes.com/wp-content/uploads/2010/12/*.jpg[/galleria][/code]
    I know this WONT work, but i think is a friendly way to show you what i am looking for, in fact this will be a really easy way to do what i want.

    Please if anyone find the solution let me know, i am not a coder, but i do understand... So i wait for your fast replay!

    THANKS YOU.

    Posted 1 year ago #
  2. Hi Victorross,
    Since this is the second time that I see this kind of request on the forum, I decided to make a simple script that should solve your problem.

    1. Upload the photos in your preferred directory using the FTP client (IE "image_dir")
    2. Upload in the same folder the scan.php file attached to this post
    3. Using the browser, launch that php script (IE go to http://YOUR_SITE_URL/SOMEOTHER_DIR/image_dir/scan.php)
    4. You should get a list with the url of all the images in that folder
    5. That list is ready to be copy-pasted in your preferred Awake shortcode.

    Here is an example of the result you'll get using this simple script.

    For any problem/question write here or send me a PM.

    Attachments

    1. scan.zip (0.4 KB, 19 downloads) 1 year old
    Posted 1 year ago #
  3. Victorross
    Member

    Hi Raspo! Thanks a lot for the solution, it is easy than the original way but i would like to know if there is anyway to get the list between the [galleria][/galleria] so i dont have to copy-paste, of course i am very happy for this solution, as i told you it is faster than the original way, but if someone know a little more about how to do it "automatic" it will be preciated.
    Please let the post open for a few days so other users can see the topic and maybe i can find someone else with a better solution.
    Once again, thanks for the trick!

    Posted 1 year ago #
  4. Ok, I'll leave it open for now.

    Posted 1 year ago #
  5. Victorross
    Member

    Raspo, other way i think will be a best solution is to list all the files in the folder and subfoldres, please if this is not too much to ask give me the solution to list the folder where the scan.php is and also the subfolders.

    Another question, i have read a post here in the forum that i am looking for pagination of this fancy images, http://www.portalcorrientes.com/2010/12/24/hello-world/ please take a look again to my post in my web and tell me if it is anyway to make a pagination for this images.

    Another more easy question, as i told you i am from argentina so i have to translate the text, i am looking for the "Click here to cancel reply." I think it is in some of the default wordpress .php files and not in the awake's files. Please let me know if you can find it easy.

    THANKS A LOT FOR YOUR SUPPORT.

    Posted 1 year ago #
  6. Raspo, that script worked like a champ! Thanks so much!

    Posted 1 year ago #
  7. Hi Victorross,
    listing subfolders too would require quite a bit more work, sorry.

    For questions regarding other topics, it's better to open new posts about them.
    Anyway, since it was a quickie one, the text for the "cancel reply" is located in \wp-includes\comment-template.php at line 1142
    $text = __('Click here to cancel reply.');
    Be very careful when editing wordpress core files.

    Glad it worked for you too, bballhermit.

    Posted 1 year ago #
  8. Elliott
    Support

    Nice fix Raspo, added to tutorials.

    Posted 1 year ago #
  9. Victorross
    Member

    Ok! Thanks raspo, i get the code that let me list all the folders and subfolders with files inside:

    <?php
    $dir = scandir("./");
    
    echo "<ul>";
    foreach($dir as $v1){
    if($v1 != "." && $v1 != ".."){
    if(is_file("./".$v1)){
    echo "http://". $_SERVER['SERVER_NAME'] ."/". $v1 ."<br />";
    }
    ////  si es un directorio se lo recorre ///////
    if(is_dir("./".$v1)){
    echo "<li><strong>". $v1 ."</strong>";
    
    $dir2 = scandir("./".$v1);
    
    echo "<ul>";
    foreach($dir2 as $v2){
    if($v2 != "." && $v2 != ".."){
    if(is_file("./".$v1."/".$v2)){
    echo "http://". $_SERVER['SERVER_NAME'] ."/". $v1 ."/". $v2 ."<br />";
    }
    ////  si es un nuevo directorio se lo recorre ///////
    if(is_dir("./".$v1."/".$v2)){
    echo "<li><strong>". $v2 ."</strong>";
    
    $dir3 = scandir("./".$v1."/".$v2);
    
    echo "<ul>";
    foreach($dir3 as $v3){
    if($v3 != "." && $v3 != ".."){
    if(is_file("./".$v1."/".$v2."/".$v3)){
    echo "http://". $_SERVER['SERVER_NAME'] ."/". $v1 ."/". $v2 ."/". $v3 ."<br />";
    }
    ////  si es un nuevo directorio se lo recorre ///////
    if(is_dir("./".$v1."/".$v2."/".$v3)){
    echo "<li><strong>". $v3 ."</strong>";
    
    $dir4 = scandir("./".$v1."/".$v2."/".$v3);
    
    echo "<ul>";
    foreach($dir4 as $v4){
    if($v4 != "." && $v4 != ".."){
    if(is_file("./".$v1."/".$v2."/".$v3."/".$v4)){
    echo "http://". $_SERVER['SERVER_NAME'] ."/". $v1 ."/". $v2 ."/". $v3 ."/". $v4 ."<br />";
    }
    ////  si es un nuevo directorio se lo recorre ///////
    if(is_dir("./".$v1."/".$v2."/".$v3."/".$v4)){
    echo "<li><strong>". $v4 ."</strong>";
    }
    }
    }
    echo "</ul>";
    }
    }
    }
    echo "</ul>";
    }
    }
    }
    echo "</ul>";
    }
    }
    }
    echo "</ul>";
    ?>

    I hope someone else can use it so i paste here!

    SEE YOU!

    Posted 1 year ago #
  10. Thank you Elliott and thanks for the contribution to you too, Victorross.

    I think that this topic can be considered resolved now.

    Posted 1 year ago #
  11. Victorross
    Member

    Hi, its me again. Just one question, is there anyway to replace

    http://". $_SERVER['SERVER_NAME'] .

    with the url for the scan.php archive
    i mean the full url for the folder where i upload that php file.
    For example if i upload it to http://www.mywebsite.com/images/soccer/scan.php
    Can i get the full url

    http://www.mywebsite.com/images/soccer/

    with a php function?

    Thanks for the support!

    Posted 1 year ago #
  12. Hi Victorross,
    actually, the super-simple script that I posted, should be able to do that already.

    Here is an example with more depth.

    Posted 1 year ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme