rss logo

A simple PHP code to show pictures on a website

Let's say that we have a lot of pictures that we want to show on a website. Here is a PHP code to automaticly show this pictures.

Configuration

Code

<!-- Role : Show multiple pictures
- Author : http://shebangthedolphins.net/
- Instructions  : 
 * Put your pictures inside : ../pictures/
- 1.0 first version -->

<!doctype html>
<HTML>
<HEAD><TITLE>Pictures</TITLE></HEAD>
<H2>Pictures</H2>
        <?php  
                $files = glob('../pictures/*.{jpg,png,gif}', GLOB_BRACE);
                foreach($files as $file) {
                        echo "<img src=\"$file\" style=\"width: 70%; height: 70%\"/><br /><br />";
                }
        ?>
        </BODY>
</HTML>


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address