';
//显示图片、视频
if (!empty($category['files'])) { //一级目录支持
$pageStartIndex = ($viewData['page']-1) * $viewData['pageSize'];
$index = 0;
foreach ($category['files'] as $file) {
if (empty($file['extension']) || !in_array($file['extension'], $supportedExts)) {
continue;
}
//翻页支持
if ($index < $pageStartIndex) {
$index ++;
continue;
}else if ($index >= $pageStartIndex + $viewData['pageSize']) {
break;
}
$title = !empty($file['title']) ? $file['title'] : $file['filename'];
//图片、视频显示文件修改日期
$title = Common::getDateFromString($file['filename']);
if (empty($title) && !empty($file['fstat']['mtime']) && !empty($file['fstat']['ctime'])) {
$title = date('Y-m-d', min($file['fstat']['mtime'], $file['fstat']['ctime']));
}
if (in_array($file['extension'], $imgExts)) {
//缩略图
$imgUrl = urlencode($file['path']);
$smallUrl = "/site/smallimg/?id={$file['id']}&url={$imgUrl}";
if (empty(FSC::$app['config']['enableSmallImage']) || FSC::$app['config']['enableSmallImage'] === 'false') {
$smallUrl = $file['path'];
}
//大图(支持中尺寸的缩略图)
$bigUrl = "/site/smallimg/?id={$file['id']}&url={$imgUrl}&size=middle";
if (empty(FSC::$app['config']['enableSmallImageForWan']) || FSC::$app['config']['enableSmallImageForWan'] === 'false') {
$bigUrl = $file['path'];
}
echo <<
{$title}
{$btnSetSnap}
eof;
}else if (in_array($file['extension'], $videoExts)) { //输出视频
//m3u8支持
if ($file['extension'] == 'm3u8') {
$videoUrl = urlencode("{$file['path']}&cid={$viewData['cacheDataId']}");
}else {
$videoUrl = urlencode($file['path']);
}
$linkUrl = "/site/player?id={$file['id']}&pid={$file['pid']}&cid={$viewData['cacheDataId']}&url={$videoUrl}";
if ($viewData['showType'] == 'video') {
$linkUrl .= "&page={$viewData['page']}&limit={$viewData['pageSize']}";
}
echo <<