get-images.php 393 B

123456789101112131415
  1. <?
  2. $dir = "images/thumbs/";
  3. $images = array();
  4. $d = dir($dir);
  5. while($name = $d->read()){
  6. if(!preg_match('/\.(jpg|gif|png)$/', $name)) continue;
  7. $size = filesize($dir.$name);
  8. $lastmod = filemtime($dir.$name)*1000;
  9. $images[] = array('name'=>$name, 'size'=>$size,
  10. 'lastmod'=>$lastmod, 'url'=>$dir.$name);
  11. }
  12. $d->close();
  13. $o = array('images'=>$images);
  14. echo json_encode($o);
  15. ?>