Created
May 7, 2012 17:26
-
-
Save joshjensen/2629102 to your computer and use it in GitHub Desktop.
Pull Images and Return JSON Array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Cache-Control: no-cache, must-revalidate'); | |
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | |
header('Content-type: application/json;'); | |
$file_array = array(); | |
if ($handle = opendir('.')) { | |
while (false !== ($entry = readdir($handle))) { | |
$ext = pathinfo($entry, PATHINFO_EXTENSION); | |
if ($entry != "." && $entry != ".." && $entry != ".DS_Store" && $entry != 'index.php' && $ext == 'jpg' || $ext == 'png') { | |
array_push($file_array, 'http://imattic.com/paper/'.$entry); | |
} | |
} | |
closedir($handle); | |
} | |
echo json_encode($file_array); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment