Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $unkwown_files = scandir($_SERVER['DOCUMENT_ROOT'] . "/path/images");
  2. foreach($unkwown_files as $file) {
  3. $exploded_filename = explode(".", $file);
  4. $file_type = array_pop($exploded_filename);
  5. $accepted_filetypes = [
  6. "png",
  7. "jpg",
  8. "gif",
  9. "jpeg"
  10. ];
  11. $picture_names = [];
  12. if (in_array($file_type, $accepted_filetypes)) {
  13. $picture_names[] = $file;
  14. }
  15. }
  16. foreach($picture_names as $picture) {
  17. $path_to_image = . "/nodes/images" . $picture;
  18. echo '<img src="' . $path_to_image . '" class="upload_thumbnail"/>';
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement