Browse Source

fancybox toolbar improved, add config for big image

master
filesite 3 months ago
parent
commit
31f64c8c42
  1. 3
      conf/app.php
  2. 12
      themes/beauty/views/site/index.php
  3. 17
      www/js/beauty.js

3
conf/app.php

@ -54,7 +54,8 @@ $configs = array( @@ -54,7 +54,8 @@ $configs = array(
'screenshot_start' => 1000, //视频播放页快照截取开始时间,单位:毫秒
'screenshot_expire_seconds' => 315360000, //视频封面图缓存3650天
'small_image_zoom_rate' => 2.5, //缩略图在最小尺寸基础上的放大倍数,以确保清晰度
'enableSmallImage' => true, //开启图片小尺寸缩略图,设置 false 则关闭
'enableSmallImage' => true, //列表页面是否开启缩略图,true 为显示缩略图,false 则显示原图
'enableSmallImageForWan' => false, //外网使用时,点击图片打开fancybox时是否显示缩略图:true 显示缩略图, false 则显示原图
/*
//视频皮肤配置

12
themes/beauty/views/site/index.php

@ -294,15 +294,25 @@ eof; @@ -294,15 +294,25 @@ eof;
}
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 = $smallUrl;
if (empty(FSC::$app['config']['enableSmallImageForWan']) || FSC::$app['config']['enableSmallImageForWan'] === 'false') {
$bigUrl = $file['path'];
}
echo <<<eof
<div class="im_item bor_radius col-xs-6 col-sm-4 col-md-3 col-lg-2">
<a href="javascript:;" class="bor_radius" data-fancybox="gallery"
data-src="{$file['path']}"
data-src="{$bigUrl}"
data-download-src="{$file['path']}"
data-download-filename="{$file['filename']}.{$file['extension']}"
data-caption="{$title} - {$file['filename']}"
data-pid="{$file['pid']}"
title="{$title} - {$file['filename']}">

17
www/js/beauty.js

@ -87,10 +87,23 @@ if ($('#image_site').get(0)) { @@ -87,10 +87,23 @@ if ($('#image_site').get(0)) {
// 图片浏览
Fancybox.bind('[data-fancybox]', {
toolbar: true,
Toolbar: {
display: {
left: ["infobar"],
middle: [
"zoomIn",
"zoomOut",
"toggle1to1",
"rotateCCW",
"rotateCW",
"flipX",
"flipY",
],
right: ["slideshow", "fullscreen", "thumbs", "download", "close"],
},
},
loop: true,
smallBtn: false,
buttons: ["zoom", "slideShow", "fullScreen", "download", "thumbs", "close"],
iframe: {
preload: false
},

Loading…
Cancel
Save