Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $unkwown_files = scandir($_SERVER['DOCUMENT_ROOT'] . "/path/images");
- foreach($unkwown_files as $file) {
- $exploded_filename = explode(".", $file);
- $file_type = array_pop($exploded_filename);
- $accepted_filetypes = [
- "png",
- "jpg",
- "gif",
- "jpeg"
- ];
- $picture_names = [];
- if (in_array($file_type, $accepted_filetypes)) {
- $picture_names[] = $file;
- }
- }
- foreach($picture_names as $picture) {
- $path_to_image = . "/nodes/images" . $picture;
- echo '<img src="' . $path_to_image . '" class="upload_thumbnail"/>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement