3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $uploads_folder = "/home/yourUnixUsername/public_html/uploads/"; $web_folder = "/uploads/"; $image_requested = $_GET['pic']; // filename from url $images = array(); if(file_exists($uploads_folder.$image_requested)) // if that image exists, get every image from that folder { if ($dh = opendir($uploads_folder)) { $inc = 0; while (($file = readdir($dh)) !== false) { if (!is_dir($uploads_folder.$file)) { $images[$inc]=$web_folder.$file; // construct a web path to image $inc++; } } closedir($dh); } } foreach($images as $an_image) { echo '<img src="'.$an_image.'">'; } ?>
Output for 5.3.0 - 7.1.0
Notice: Undefined index: pic in /in/MmAfD on line 6
Output for 4.3.0 - 5.2.17
Notice: Undefined index: pic in /in/MmAfD on line 6