Created
August 21, 2012 11:54
-
-
Save marcogrueter/3414893 to your computer and use it in GitHub Desktop.
php output for jquery cycle
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
<?php | |
//funktions aufruf | |
bilder_ausgeben('./uploads/default/files/'); | |
function bilder_ausgeben($ordner) | |
{ | |
$erlaubte_bilder = array('gif', 'jpeg', 'png', 'jpg'); | |
if( ! is_dir($ordner) ) | |
{ | |
echo 'Ordner ungültig'; | |
return; | |
} | |
$oh = opendir($ordner); | |
if( ! $oh ) | |
{ | |
echo "ordner kann nicht geöffnet werden"; | |
return; | |
} | |
while (false !== ($dateiname = readdir($oh ))) { | |
//. und .. sind ordner, also überspringen | |
if | |
( | |
$dateiname != '.' && $dateiname != '..' | |
&& is_file($ordner . $dateiname) | |
&& in_array( strtolower( pathinfo($dateiname, PATHINFO_EXTENSION) ), $erlaubte_bilder ) | |
) | |
{ | |
echo '<img src="' . $ordner . '/' . $dateiname . '" />'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment