Hey I have an assignment where I need to make a gallery. This code I have now just shows the pictures but I want to make thumbnails for these pictures.
How can I do this? Any suggestions?
<html>
<head>
<style type="text/css">
ul {
list-style:none;
}
</style>
</head>
<body>
<ul>
<?php
$imgdir = 'images/';
$allowed_types = array('png', 'jpg', 'jpeg', 'gif');
$dimg = opendir($imgdir);
while($imgfile = readdir($dimg)) {
if(in_array(strtolower(substr($imgfile, -3)), $allowed_types) or in_array(strtolower(substr($imgfile, -4)), $allowed_types)) {
$a_img[] = $imgfile;
}
}
echo "<ul>";
$totimg = count($a_img);
for($x=0; $x < $totimg; $x++) {
echo "<li><img src='" . $imgdir . $a_img[$x] . "' /></li>";
}
echo "</ul>";
?>
</ul>
</body>
</html>