Display images from folder in table using php,html? -
i want display images in table form. here code:
<?php $files = glob("images/*.*"); ($i = 0; $i < count($files); $i++) { $image = $files[$i]; $supported_file = array( 'gif', 'jpg', 'jpeg', 'png' ); $ext = strtolower(pathinfo($image, pathinfo_extension)); if (in_array($ext, $supported_file)) { echo basename($image); echo '<img src="' . $image . '" alt="random image" ,width=100px, height=100px /><br>'; } else { continue; } } ?>
something picture.
if want in table add table tag , it
<table> <tr> <th>image name</th> <th>image</th> </tr> <?php $files = glob("images/*.*"); ($i = 0; $i < count($files); $i++) { $image = $files[$i]; $supported_file = array( 'gif', 'jpg', 'jpeg', 'png' ); $ext = strtolower(pathinfo($image, pathinfo_extension)); if (in_array($ext, $supported_file)) { echo "<tr><td>"; echo basename($image); echo "</td><td>"; echo '<img src="' . $image . '" alt="random image" ,width=100px, height=100px /><br>'; echo "</td></tr>"; } else { continue; } } ?> </table>
wiki
Comments
Post a Comment