Created
November 4, 2014 21:46
-
-
Save matdombrock/3d7842c80df278035937 to your computer and use it in GitHub Desktop.
Display links to all files inside a folder on your server.
This file contains 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
<html> | |
<head> | |
<title>Show images in folder</title> | |
<style type="text/css"> | |
body { | |
margin: 0 auto 20px; | |
padding: 0; | |
background: black; | |
} | |
a{ | |
color:white; | |
} | |
td { | |
font: 9px sans-serif; | |
} | |
table { | |
width: 100%; | |
} | |
img { | |
display: block; | |
margin: 20px auto 10px; | |
max-width: 900px; | |
outline: none; | |
} | |
</style> | |
</head> | |
<body> | |
<?php | |
$folder = ''; | |
$filetype = '*.*'; | |
$files = glob($folder.$filetype); | |
$count = count($files); | |
echo '<table>'; | |
for ($i = 0; $i < $count; $i++) { | |
echo '<tr><td>'; | |
echo '<a name="'.$i.'" href="'.$files[$i].'">"'.$files[$i].'"</a>'; | |
echo substr($files[$i],strlen($folder),strpos($files[$i], '.')-strlen($folder)); | |
echo '</td></tr>'; | |
} | |
echo '</table>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment