Browse Source

bug fix: show default image when there is not images of videos

master
filesite 2 years ago
parent
commit
7a14969283
  1. 4
      themes/googleimage/views/site/index.php
  2. 2
      themes/videoblog/controller/ListController.php
  3. 8
      themes/videoblog/views/site/index.php
  4. 4
      www/css/videoblog.css

4
themes/googleimage/views/site/index.php

@ -83,6 +83,10 @@ eof;
if (in_array($first_img['extension'], $imgExts)) { if (in_array($first_img['extension'], $imgExts)) {
echo <<<eof echo <<<eof
<img data-src="{$first_img['path']}" class="lazyload" alt="{$first_img['filename']}"> <img data-src="{$first_img['path']}" class="lazyload" alt="{$first_img['filename']}">
eof;
}else {
echo <<<eof
<img src="/img/default.png" alt="default image">
eof; eof;
} }
} }

2
themes/videoblog/controller/ListController.php

@ -97,7 +97,7 @@ Class ListController extends Controller {
'url' => $parent['path'], 'url' => $parent['path'],
]); ]);
$parent = !empty($menus[$parent['pid']]) ? $menus[$parent['pid']] : null; $parent = !empty($parent['pid']) && !empty($menus[$parent['pid']]) ? $menus[$parent['pid']] : null;
} }
return $breads; return $breads;

8
themes/videoblog/views/site/index.php

@ -101,6 +101,10 @@ eof;
if (in_array($first_img['extension'], $imgExts)) { if (in_array($first_img['extension'], $imgExts)) {
echo <<<eof echo <<<eof
<img data-src="{$first_img['path']}" class="lazyload" alt="{$first_img['filename']}"> <img data-src="{$first_img['path']}" class="lazyload" alt="{$first_img['filename']}">
eof;
}else {
echo <<<eof
<img src="/img/default.png" alt="default image">
eof; eof;
} }
} }
@ -133,7 +137,9 @@ eof;
} }
$duration = !empty($category['duration']) ? $category['duration'] : ''; $duration = !empty($category['duration']) ? $category['duration'] : '';
$snapshot = !empty($file['snapshot']) ? $file['snapshot'] : (!empty($category['snapshot']) ? $category['snapshot'] : $first_img['path']); $snapshot = !empty($file['snapshot']) ? $file['snapshot'] : (!empty($category['snapshot']) ? $category['snapshot'] :
(!empty($first_img['path']) ? $first_img['path'] : '/img/default.png')
);
$title = !empty($category['title']) ? $category['title'] : $file['filename']; $title = !empty($category['title']) ? $category['title'] : $file['filename'];
echo <<<eof echo <<<eof

4
www/css/videoblog.css

@ -24,7 +24,7 @@ a{color: #aaadb2;text-decoration: none}
.img-item{display: inline-block;margin-left: 10px;margin-right: 10px;margin-bottom: 20px;cursor: pointer} .img-item{display: inline-block;margin-left: 10px;margin-right: 10px;margin-bottom: 20px;cursor: pointer}
.img-item img{height: 180px;object-fit: cover;} .img-item img{height: 180px;object-fit: cover;}
.img-item strong{display: block;color: #bdc1c6;font-family: Roboto,Arial,sans-serif;font-size: 12px;letter-spacing: .2px;line-height: 20px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap} .img-item strong{display: block;color: #bdc1c6;font-family: Roboto,Arial,sans-serif;font-size: 12px;letter-spacing: .2px;line-height: 20px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}
.img-item .img-con{display:block;position: relative;width: 100%;height: auto} .img-item .img-con{display:block;position: relative;width: 100%;height: auto;text-align:center}
.img-item .duration{display: block;position: absolute;right: 2px;bottom: 5px;background-color: #000;opacity: 0.6;padding: 1px 3px;color: #FFF;border-radius:3px;font-weight: bold;} .img-item .duration{display: block;position: absolute;right: 2px;bottom: 5px;background-color: #000;opacity: 0.6;padding: 1px 3px;color: #FFF;border-radius:3px;font-weight: bold;}
.img-item:hover .vjs-big-play-button{display: inherit !important} .img-item:hover .vjs-big-play-button{display: inherit !important}
.catedesc{padding: 0 10px} .catedesc{padding: 0 10px}
@ -47,4 +47,4 @@ a{color: #aaadb2;text-decoration: none}
@media only screen and (min-width: 768px) and (max-width: 1024px) { @media only screen and (min-width: 768px) and (max-width: 1024px) {
.menu{font-size: 14px} .menu{font-size: 14px}
.img-item strong{font-size: 13px;} .img-item strong{font-size: 13px;}
} }

Loading…
Cancel
Save