Last active
February 2, 2016 19:14
-
-
Save FuruholmAnton/fdddd857ca48abfb867d to your computer and use it in GitHub Desktop.
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 | |
function listFolderFiles($dir){ | |
$foldersAndFiles = scandir($dir); | |
foreach($foldersAndFiles as $item){ | |
if (!in_array($item,array(".",".."))){ // scandir() adds . and .. to the array | |
// Write it out if its an image | |
if (strpos($item, '.jpg') !== false || | |
strpos($item, '.png') !== false || | |
strpos($item, '.gif') !== false ){ | |
echo $dir."/".$item."<br>"; | |
} | |
// Write out heading-comment and enter the next folder | |
if(is_dir($dir.'/'.$item)){ | |
echo "<br># ".$item."<br>"; | |
listFolderFiles($dir.'/'.$item); | |
} | |
} | |
} | |
} | |
// The master folder for all images | |
listFolderFiles('images'); | |
echo "<br># minified<br>"; | |
listFolderFiles('min'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment