Skip to content

Commit 66a03c3

Browse files
committed
display thumbnail icon when thumbnail not found in grid view, fix file icon vertical align
1 parent 48941f0 commit 66a03c3

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

public/css/lfm.css

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,28 @@ html, body {
5555

5656
.hidden {
5757
display: none;
58-
}
58+
}
59+
60+
.square {
61+
position: absolute;
62+
top: 0;
63+
right: 0;
64+
bottom: 0;
65+
left: 0;
66+
}
67+
.icon-container {
68+
width: 100%;
69+
height: 100%;
70+
text-align: center;
71+
margin: 0 auto;
72+
}
73+
.icon-container:before {
74+
content: '';
75+
display: inline-block;
76+
vertical-align: middle ;
77+
height: 100%;
78+
}
79+
.icon-container > i {
80+
display: inline-block;
81+
vertical-align: middle;
82+
}

src/views/item.blade.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
<?php $file_name = $file_info[$key]['name'];?>
22
@if($type == 'Images')
33
<?php $thumb_src = $thumb_url . $file_name;?>
4+
<?php $thumb_not_found = realpath(public_path($thumb_src)) === false; ?>
45
@endif
56

67
<div class="col-sm-4 col-md-3 col-lg-2 img-row">
78

8-
<div class="thumbnail thumbnail-img text-center" data-id="{{ $file_name }}" id="img_thumbnail_{{ $key }}">
9+
<div class="thumbnail thumbnail-img text-center" data-id="{{ $file_name }}" id="img_thumbnail_{{ $key }}" style="max-width: 210px;max-height: 210px;">
10+
<div style="width:100%;padding-bottom:100%;position: relative;">
911
@if($type == 'Images')
10-
<img id="{{ $file_name }}" src="{{ $thumb_src }}" alt="" class="pointer" onclick="useFile('{{ $file_name }}')">
12+
@if($thumb_not_found)
13+
<div class="square icon-container">
14+
<i class="fa fa-image fa-5x pointer" onclick="useFile('{{ $file_name }}')"></i>
15+
</div>
16+
@else
17+
<img id="{{ $file_name }}" src="{{ $thumb_src }}" style="max-width: 100%" class="pointer square" onclick="useFile('{{ $file_name }}')">
18+
@endif
1119
@else
12-
<i class="fa {{ $file['icon'] }} fa-5x" style="height:200px;cursor:pointer;padding-top:60px;" onclick="useFile('{{ $file_name }}')"></i>
20+
<div class="square icon-container">
21+
<i class="fa {{ $file['icon'] }} fa-5x pointer" onclick="useFile('{{ $file_name }}')"></i>
22+
</div>
1323
@endif
24+
</div>
1425
</div>
1526

1627
<div class="caption text-center">

0 commit comments

Comments
 (0)