Stream/load images directly from a folder

moss.lauren's Avatar

moss.lauren

22 Jan, 2013 07:32 PM

Hi,

Can i load images directly from a folder rather than manually putting them in? Ie: get all images from 'images' displaying in a gallery?

Thanks
LM

  1. Support Staff 1 Posted by Dmitry Semenov on 23 Jan, 2013 05:39 PM

    Dmitry Semenov's Avatar

    Hi,

    Thank you for suggestion, but there won't be such option as it's not seo-friendly and resource-intensive.

    Dmitry

  2. 2 Posted by nicholas.laspin... on 13 Nov, 2013 05:00 AM

    nicholas.laspina's Avatar

    I'm using the following code I've written with some .php- Be sure to name your file with the .php extension- It will iterate through the images in a folder, however, linking and description blocks will not be available.

      <body>

    <?php
    // image folder path
    $imglist = array();
    $img_folder = "../slider_images/";

    //use the directory class
    $imgs = dir($img_folder);
    while ($file = $imgs->read()) {
       if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file)){
          $imglist[] = $file;
       }
    }
    closedir($imgs->handle);
    ?>
       <div class="sliderContainer fullWidth clearfix">
    <div id="bannerSlider" class="royalSlider">
      
       <?php
       foreach($imglist as $image) { ?>
       <div class="rsContent">
    <img class="rsImg" src="<?=$img_folder.$image?>">
     </div>
    <?php
    }
    ?> </div>

  3. Support Staff 3 Posted by Dmitry Semenov on 13 Nov, 2013 07:50 AM

    Dmitry Semenov's Avatar

    THanks for sharing Nicholas, I'm sure it'll help someone.

    Dmitry

  4. 4 Posted by murdertonic on 08 Jul, 2014 10:57 AM

    murdertonic's Avatar

    I used this, thank you so much. It was perfect : )

  5. 5 Posted by info on 21 Sep, 2015 06:52 PM

    info's Avatar

    Works like a charm. Thank you so much for this.

  6. 6 Posted by vvtv01 on 24 Nov, 2016 10:36 AM

    vvtv01's Avatar

    Could you please show me the whole page with this code and with the slider? I dont know where to put it...

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac