This is probably a very simple solution but I am new to PHP I have been searching google to find out how to get it to work to no avail. Here is my problem I want to be able to use the glob function along with extract(pathinfo) to find all images in a folder and print them into an html page. I can only get one image to print to the screen I figured it would print them in order it finds the files. Here is my code:
<?php
$images = glob('*.{png,jpg,jpeg}', GLOB_BRACE);
foreach($images as $img) {
extract(pathinfo($img));
$thumb_name = "$filename.$extension";
//$thumb_name = $info['filename'] . '.' . $info['extension'];
echo $thumb_name . "\n";
}
?>
And finally the html file:
<?php include 'index.php' ?>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
<?php echo "<img src=\"$thumb_name\" title=\"bar\" alt=\"foo\" />"; ?>
<?php echo "<img src=\"$thumb_name\" title=\"bar\" alt=\"foo\" />"; ?>
</body>
</html>
not actual working code, but just for u to get an idea
Put the echo img inside the for loop