stuart
Chevereto Member
I've just added my own home brew random image module to the bottom of my new adult image hosting site 🙂
Feel free to critique it and I've provided the code below if anyone has any suggestions to make it faster / better coded.
http://www.imagetease.com/
Feel free to critique it and I've provided the code below if anyone has any suggestions to make it faster / better coded.
http://www.imagetease.com/
PHP:
<?php
//path to directory to scan. i have included a wildcard for a subdirectory
$directory = "images/thumbs/";
//get all image files with a .jpg extension.
$images = glob("" . $directory . "*.jpg");
$imgs = '';
// create array
foreach($images as $image){ $imgs[] = "$image"; }
//shuffle array
shuffle($imgs);
$imgs = array_slice($imgs, 0, 12);
//display images
foreach ($imgs as $img) {
$imgname = str_replace("images/thumbs/", "", $img);
echo "<a href=\"http://www.imagetease.com/?v=$imgname\"><img src='$img' class=\"randomphotos\"/></a>";
}
?>