Skip to content
Permalink
Browse files

opt static source

  • Loading branch information...
WangNingkai committed Dec 9, 2018
1 parent ed4bdc7 commit 2081da728f73514e407d73920b797eac0c6f5b95
@@ -30,13 +30,15 @@ class Constants
const FILE_ICON
= [
'stream' => ['fa-file-text-o', ['txt', 'log']],
'stream' => ['fa-file-text-o', 'text', ['txt', 'log']],
'image' => [
'fa-file-image-o',
'image',
['bmp', 'jpg', 'jpeg', 'png', 'gif', 'ico', 'jpe'],
],
'video' => [
'fa-file-video-o',
'video',
[
'mkv',
'mp4',
@@ -53,9 +55,10 @@ class Constants
'flv',
],
],
'audio' => ['fa-file-audio-o', ['ogg', 'mp3', 'wav']],
'audio' => ['fa-file-audio-o', 'music', ['ogg', 'mp3', 'wav']],
'code' => [
'fa-file-code-o',
'code',
[
'html',
'htm',
@@ -72,6 +75,7 @@ class Constants
],
'doc' => [
'fa-file-word-o',
'doc',
[
'csv',
'doc',
@@ -93,13 +97,14 @@ class Constants
'xlsx',
],
],
'pdf' => ['fa-file-pdf-o', ['pdf']],
'pdf' => ['fa-file-pdf-o', 'pdf', ['pdf']],
'zip' => [
'fa-file-archive-o',
'zip',
['zip', '7z', 'rar', 'bz', 'gz'],
],
'android' => ['fa-android', ['apk']],
'exe' => ['fa-windows', ['exe', 'msi']],
'android' => ['fa-android', 'app', ['apk']],
'exe' => ['fa-windows', 'exe', ['exe', 'msi']],
];
const SITE_THEME
@@ -202,22 +202,21 @@ public static function getEncodeUrl($path)
}
/**
* 获取文件图标
*
* @param $ext
* @param string $ext
* @param bool $img
*
* @return string
*/
public static function getExtIcon($ext = '')
public static function getExtIcon($ext = '', $img = false)
{
$patterns = Constants::FILE_ICON;
$icon = '';
foreach ($patterns as $key => $suffix) {
if (in_array($ext, $suffix[1])) {
$icon = $suffix[0];
if (in_array($ext, $suffix[2])) {
$icon = $img ? $suffix[1] : $suffix[0];
break;
} else {
$icon = 'fa-file-text-o';
$icon = $img ? 'file' : 'fa-file-text-o';
}
}
BIN +9.32 KB public/img/app.png
Binary file not shown.
BIN +6.1 KB public/img/code.png
Binary file not shown.
BIN +10.6 KB public/img/doc.png
Binary file not shown.
BIN +8.4 KB public/img/exe.png
Binary file not shown.
BIN +4.39 KB public/img/file.png
Binary file not shown.
BIN +3.75 KB public/img/folder.png
Binary file not shown.
BIN +7.07 KB public/img/image.png
Binary file not shown.
BIN +13.1 KB public/img/loading.gif
Binary file not shown.
BIN +9.42 KB public/img/mp4.png
Binary file not shown.
BIN +8.46 KB public/img/music.png
Binary file not shown.
BIN +9.11 KB public/img/pdf.png
Binary file not shown.
BIN +10.4 KB public/img/return.png
Binary file not shown.
BIN +4.58 KB public/img/text.png
Binary file not shown.
BIN +4.56 KB public/img/video.png
Binary file not shown.
BIN +7.67 KB public/img/zip.png
Binary file not shown.
@@ -109,7 +109,7 @@ class="mdui-m-t-3 thumb-view mdui-row-xs-3 mdui-row-sm-4 mdui-row-md-5 mdui-row-
<div class="mdui-col">
<a href="{{ route('home',\App\Helpers\Tool::getEncodeUrl(\App\Helpers\Tool::getParentUrl($path_array))) }}">
<div class="col-icon">
<img src="https://i.loli.net/2018/12/07/5c09d7355ea27.png" alt="">
<img src="{{ asset('img/return.png') }}" class="mdui-p-a-1" alt="">
</div>
<div class="col-detail mdui-text-center">
<div class="col-title">
@@ -129,7 +129,7 @@ class="mdui-m-t-3 thumb-view mdui-row-xs-3 mdui-row-sm-4 mdui-row-md-5 mdui-row-
<a href="{{ route('home',\App\Helpers\Tool::getEncodeUrl($origin_path ? $origin_path.'/'.$item['name'] : $item['name'])) }}">
<div class="col-icon">
<img
src=" https://i.loli.net/2018/12/07/5c09d6920f8ac.png"
src="{{ asset('img/folder.png') }}"
alt="">
</div>
<div class="col-detail mdui-text-center">
@@ -148,12 +148,14 @@ class="mdui-m-t-3 thumb-view mdui-row-xs-3 mdui-row-sm-4 mdui-row-md-5 mdui-row-
<a target="_blank"
href="{{ route('show',\App\Helpers\Tool::getEncodeUrl($origin_path ? $origin_path.'/'.$item['name'] : $item['name'])) }}">
<div class="col-icon">
@if(in_array($item['ext'],['bmp','jpg','jpeg','png','gif']))
@if(in_array($item['ext'],explode(' ',\App\Helpers\Tool::config('image'))))
<img class="lazy"
data-original="{{ route('thumb',['id'=>$item['id'],'size'=>'small']) }}"
src="https://i.loli.net/2018/12/04/5c0625755d6ce.gif" alt="">
src="{{ asset('img/loading.gif') }}" alt="">
@else
<img src="https://i.loli.net/2018/12/07/5c09d6920dedb.png" alt="">
<img
src="{{ asset('img/'.\App\Helpers\Tool::getExtIcon($item['ext'],true).'.png') }}"
alt="">
@endif
</div>
<div class="col-detail mdui-text-center">

0 comments on commit 2081da7

Please sign in to comment.
You can’t perform that action at this time.