services-posters/js.php

25 lines
612 B
PHP

<?
$i = 0;
$path = 'posters/0xdb.org';
$dir = dir($path);
while ($file = $dir->read()) {
if (substr($file, 0, 1) != '.') {
$subdir = dir($path . '/' . $file);
while ($subfile = $subdir->read()) {
if (substr($subfile, 0, 1) != '.') {
$url = "http://services.0xdb.org/posters/$path/$file/$subfile";
$size = getimagesize($url);
echo "poster[$i] = [];\n";
echo "poster[$i]['url'] = '$url';\n";
echo "poster[$i]['width'] = " . $size[0] . ";\n";
echo "poster[$i]['height'] = " . $size[1] . ";\n";
$i++;
}
}
}
}
$rnd = floor(mt_rand() / mt_getrandmax() * count($poster));
?>