Display Images From A Folder (slideshow)

39,032

To affect the client side, you'll need to use JavaScript. PHP only echos out static content on the server.

Here is a list of options you could use

Share:
39,032

Related videos on Youtube

Remi
Author by

Remi

Updated on August 26, 2020

Comments

  • Remi
    Remi almost 4 years

    I have been trying to google and find out how to make a .php script that will make a an automatic slideshow of images from a folder, I've only managed to get the pictures to automatically show up on the php page, but I can't figure out how to make them slide one by one, like a slideshow.

    Here is the url to the page where the images show up, so you can have a look Here is the code I've used.

    <?
    $files = glob("images/*.*");
    for ($i=0; $i<count($files); $i++)
    {
        $num = $files[$i];
        echo '<img src="'.$num.'" alt="random image" />'."<br><br>";
    }
    ?>
    

    Do you know how to make this happen? Or another way to do it? easier way? Java/XML?

    • Naftali
      Naftali over 12 years
      Try learning some javascript ^_^ it might help you out alot :-)
  • Naftali
    Naftali over 12 years
    @Remi use javascript (or if you want to look into a library like jQuery you can)
  • Remi
    Remi over 12 years
    I've heard about jQuery, but I have a no idea of where to start looking.
  • Naftali
    Naftali over 12 years
    @Remi right here on stackoverflow or just search on google :-)
  • Remi
    Remi over 12 years
    Thank you, I will try that tomorrow :)