2012-11-17, 04:25:30
You guys know you can use php code in here right ?
PHP Code:
// list of images to display
var A_ITEMS = [<?php
$s_path = 'img/';
$a_types = array ('jpg', 'gif', 'jpeg', 'png');
$a_images = array ();
$h_dir = opendir($s_path);
while ($s_file = readdir($h_dir)) {
$s_type = strtolower(substr(strrchr($s_file, '.'), 1));
if (in_array($s_type, $a_types))
array_push($a_images, "\n\t\t'$s_path$s_file'");
}
closedir($h_dir);
sort($a_images);
echo join(',', $a_images);
?>
];