Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. <?php
  2.  
  3. $files = scandir('.', SCANDIR_SORT_NONE);
  4. if (!$files) {
  5.     http_response_code(500);
  6.     exit(1);
  7. }
  8.  
  9. mime_content_type('application/json');
  10.  
  11. function images($path) {
  12.     return preg_match('/\.(jpg|png)$/', $path);
  13. }
  14.  
  15. echo json_encode(array_values(array_filter($files, 'images')))
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement