mirror of https://github.com/helloxz/imgurl
parent
6816cbafbf
commit
ea36a9af7a
13
README.md
13
README.md
|
@ -1,5 +1,5 @@
|
|||
# ImgURL
|
||||
ImgURL是一款简单、纯粹的图床程序,使用PHP + SQLite 3开发,不需要复杂的配置,做到开箱即用。
|
||||
ImgURL是一款简单、纯粹的图床程序,使用PHP + SQLite 3开发,不需要复杂的配置,开箱即用。
|
||||
|
||||
### 环境要求
|
||||
* PHP >= 5.6
|
||||
|
@ -13,11 +13,20 @@ ImgURL是一款简单、纯粹的图床程序,使用PHP + SQLite 3开发,不
|
|||
- [x] 限制访客上传数量
|
||||
- [x] 图片压缩
|
||||
- [x] 图片鉴黄
|
||||
- [x] API上传
|
||||
- [ ] 图片水印
|
||||
- [ ] API上传
|
||||
|
||||
|
||||
|
||||
### 更新日志
|
||||
#### v1.3 - 2018.09.11
|
||||
* 新增粘贴上传(Ctrl + V)
|
||||
* 期待已久的API上传
|
||||
* 后台新增按时间筛选图片
|
||||
* 优化“探索发现”,之前为随机显示12张,现在显示本月所有图片(流加载)
|
||||
* 优化后台“看图模式”
|
||||
* 修复一些BGU,优化CSS
|
||||
|
||||
#### v1.2 - 2018.08.11
|
||||
* 增加URL批量上传
|
||||
* 去掉一些不必要的菜单
|
||||
|
|
|
@ -6,10 +6,27 @@
|
|||
|
||||
// 获取类型
|
||||
$type = $_GET['type'];
|
||||
//获取时间
|
||||
@$date = $_GET['date'];
|
||||
//如果时间不为空
|
||||
if($date != ''){
|
||||
$thedate = explode("|",$date);
|
||||
$starttime = $thedate[0];
|
||||
$endtime = $thedate[1];
|
||||
//翻页选项
|
||||
$thepage = '&date='.$date;
|
||||
}
|
||||
else{
|
||||
$starttime = '';
|
||||
//获取当前日期
|
||||
$endtime = date("Y-m-d",time());
|
||||
//翻页选项
|
||||
$thepage = '';
|
||||
}
|
||||
//获取页数
|
||||
$page = $_GET['page'];
|
||||
//查询图片
|
||||
$imgs = $pic->querypic($type,$page);
|
||||
$imgs = $pic->newquery($type,$date);
|
||||
|
||||
$up = (int)$page - 1;
|
||||
if($up <= 0){
|
||||
|
@ -26,25 +43,34 @@
|
|||
</div>
|
||||
<!-- 后台内容部分 -->
|
||||
<div id = "adminpic">
|
||||
<div class="layui-col-lg9 layui-col-space10">
|
||||
<div class="layui-col-lg9 layui-col-space10" style="margin-bottom:6em;">
|
||||
<!--时间筛选-->
|
||||
<div id="date">
|
||||
<table class="layui-table" lay-skin="nob">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>按时间筛选:</td>
|
||||
<td><input type="text" class="layui-input" id="starttime" value = "<?php echo $starttime; ?>"></td>
|
||||
<td> - </td>
|
||||
<td><input type="text" class="layui-input" id="endtime" value = "<?php echo $endtime; ?>"></td>
|
||||
<td><button lay-submit class="layui-btn" onclick = "screen('picadmin.php')">筛选</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--时间筛选END-->
|
||||
<?php foreach ($imgs as $img) {
|
||||
$imgurl = $config['domain'].$img['path'];
|
||||
$id = $img['id'];
|
||||
?>
|
||||
<div class="layui-col-lg4 picadmin">
|
||||
<!-- <a id = "imgid<?php echo $id; ?>" href="javascript:;" onclick = "adminshow('<?php echo $imgurl ?>',<?php echo $id; ?>)"></a> -->
|
||||
<img lay-src="<?php echo $imgurl; ?>" layer-src="<?php echo $imgurl; ?>" alt="图片ID: <?php echo $id; ?>">
|
||||
<img lay-src="<?php echo $imgurl; ?>" layer-src="<?php echo $imgurl; ?>" alt="图片ID: <?php echo $id; ?>" src = "../static/loading32.gif">
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<!-- 翻页按钮 -->
|
||||
<div class="layui-col-lg9 layui-col-md-offset3">
|
||||
<div class="page">
|
||||
<a href="?type=<?php echo $type; ?>&page=<?php echo $up; ?>" class="layui-btn">上一页</a>
|
||||
<a href="?type=<?php echo $type; ?>&page=<?php echo $down; ?>" class="layui-btn">下一页</a>
|
||||
<!-- <a href="javascript:;" onclick = "delall()" class="layui-btn layui-btn-danger">删除本页</a> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 翻页按钮END -->
|
||||
<!-- 后台内容部分END -->
|
||||
</div>
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<td><input type="text" class="layui-input" id="starttime" value = "<?php echo $starttime; ?>"></td>
|
||||
<td> - </td>
|
||||
<td><input type="text" class="layui-input" id="endtime" value = "<?php echo $endtime; ?>"></td>
|
||||
<td><button lay-submit class="layui-btn" onclick = "screen()">筛选</button></td>
|
||||
<td><button lay-submit class="layui-btn" onclick = "screen('senioradmin.php')">筛选</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<?php foreach ($imgs as $img) {
|
||||
?>
|
||||
<div class="layui-col-lg4 picadmin">
|
||||
<img lay-src="<?php echo $img['url']; ?>" layer-src="<?php echo $img['url']; ?>" alt="ID: <?php echo $img['id']; ?>" />
|
||||
<img lay-src="<?php echo $img['url']; ?>" layer-src="<?php echo $img['url']; ?>" alt="ID: <?php echo $img['id']; ?>" src = "../static/loading32.gif" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
|
|
@ -10,14 +10,15 @@
|
|||
//初始化
|
||||
$domain = $config['domain'];
|
||||
$userdir = $config['userdir'];
|
||||
$sql = "SELECT `id`,`path` FROM `imginfo` WHERE (`dir` = '$userdir' AND `level` < 3 AND `date` LIKE '$thetime%') ORDER BY random() LIMIT 12";
|
||||
//$sql = "SELECT `id`,`path` FROM `imginfo` WHERE (`dir` = '$userdir' AND `level` < 3 AND `date` LIKE '$thetime%') ORDER BY random() LIMIT 12";
|
||||
$sql = "SELECT `id`,`path` FROM `imginfo` WHERE (`dir` = '$userdir' AND `level` < 3 AND `date` LIKE '$thetime%') ORDER BY `id` DESC";
|
||||
$datas = $database->query($sql)->fetchAll();
|
||||
|
||||
?>
|
||||
|
||||
<div class="layui-container" style = "margin-bottom:6em;">
|
||||
<div class="layui-row">
|
||||
<div class="msg"><i class="layui-icon"></i> 此页面随机显示本月12张图片,刷新页面可重新随机,如果不显示说明本月暂未上传图片。</div>
|
||||
<div class="msg"><i class="layui-icon"></i> 此页面显示本月上传图片,如果不显示说明本月暂未上传图片。</div>
|
||||
<div id = "found-img" class = "layui-col-space20">
|
||||
<?php foreach ($datas as $img) {
|
||||
$imgurl = $domain.$img['path'];
|
||||
|
@ -25,7 +26,7 @@
|
|||
?>
|
||||
<div class="layui-col-lg4">
|
||||
<!-- <a href="javascript:;" onclick = "userpreview('<?php echo $imgurl ?>',<?php echo $imgid; ?>)"></a> -->
|
||||
<img lay-src="<?php echo $imgurl ?>" layer-src="<?php echo $imgurl ?>">
|
||||
<img lay-src="<?php echo $imgurl ?>" layer-src="<?php echo $imgurl ?>" src = "./static/loading32.gif">
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
/*
|
||||
name:ImgURL上传API
|
||||
version:v1.0
|
||||
author:xiaoz.me
|
||||
update:2018-09-11
|
||||
*/
|
||||
header('Access-Control-Allow-Origin:*');
|
||||
//载入配置文件
|
||||
include_once("./class/class.user.php");
|
||||
|
||||
@$type = $_GET['type'];
|
||||
$type = strip_tags($type);
|
||||
//如果没有post文件
|
||||
if(!$_FILES['file']){
|
||||
$basis->re_error('未选择文件!');
|
||||
}
|
||||
//检查用户是否登录
|
||||
$status = $basis->check($config);
|
||||
|
||||
//检查用户是否登陆来判断上传目录
|
||||
if($status == 'islogin') {
|
||||
//设置上传路径
|
||||
$updir = $config['admindir'];
|
||||
}
|
||||
else{
|
||||
$updir = $config['userdir'];
|
||||
//限制用户上传数量
|
||||
$basis->limitnum();
|
||||
}
|
||||
|
||||
//获取上传者信息
|
||||
$ip = $basis->getip();
|
||||
$ua = $_SERVER['HTTP_USER_AGENT'];
|
||||
$date = date('Y-m-d',time());
|
||||
//载入上传类
|
||||
include('./class/class.upload.php');
|
||||
|
||||
//上传方法
|
||||
$handle = new upload($_FILES['file']);
|
||||
if ($handle->uploaded) {
|
||||
$handle->file_new_name_body = 'image_resized';
|
||||
//允许上传大小2m
|
||||
$handle->file_max_size = '2097152';
|
||||
//允许的MIME类型,仅运行上传图片
|
||||
$handle->allowed = array('image/*');
|
||||
|
||||
// 当前月份
|
||||
$current_time = date('ym',time());
|
||||
//上传路径:目录 + 时间
|
||||
$handle->process('../'.$updir.'/'.$current_time."/");
|
||||
if ($handle->processed) {
|
||||
//获取站点域名
|
||||
$domain = $config['domain'];
|
||||
//生成文件hash
|
||||
$fhash = hash_file("md5",$handle->file_dst_pathname,FALSE);
|
||||
$fhash = substr($fhash,8,16);
|
||||
//新的文件名(../temp/1804/\d64c8036c0605175.jpg)
|
||||
$new_img = $handle->file_dst_path.$fhash.'.'.$handle->file_dst_name_ext;
|
||||
//图片URL地址
|
||||
$imgurl = $domain.$updir.'/'.$current_time.'/'.$fhash.'.'.$handle->file_dst_name_ext;
|
||||
//图片路径(temp/1804/d64c8036c0605175.jpg)
|
||||
$imgdir = $updir.'/'.$current_time.'/'.$fhash.'.'.$handle->file_dst_name_ext;
|
||||
|
||||
//判断文件是否已经存在
|
||||
if(!is_file($new_img)) {
|
||||
//对文件更名
|
||||
rename($handle->file_dst_pathname,$new_img);
|
||||
}
|
||||
else{
|
||||
//删除原始文件
|
||||
unlink($handle->file_dst_pathname);
|
||||
}
|
||||
|
||||
//检查某张图片是否已经上传过,如果已经上传了,直接返回数据并终止操作
|
||||
$basis->isupload($imgdir);
|
||||
|
||||
//没有上传过的图片,继续写入数据库
|
||||
$last_user_id = $database->insert("imginfo", [
|
||||
"path" => $imgdir,
|
||||
"ip" => $ip,
|
||||
"ua" => $ua,
|
||||
"date" => $date,
|
||||
"dir" => $updir,
|
||||
"compress" => 0,
|
||||
"level" => 0
|
||||
]);
|
||||
//返回最后的ID
|
||||
$account_id = $database->id();
|
||||
//上传成功,返回json数据
|
||||
$redata = array(
|
||||
"code" => 1,
|
||||
"id" => $account_id,
|
||||
"url" => $imgurl,
|
||||
"width" => $handle->image_dst_x,
|
||||
"height" => $handle->image_dst_y
|
||||
);
|
||||
|
||||
//直接返回图片URL
|
||||
if($type == 'url'){
|
||||
echo $imgurl;
|
||||
}
|
||||
else{
|
||||
//返回json
|
||||
echo $redata = json_encode($redata);
|
||||
}
|
||||
|
||||
$handle->clean();
|
||||
//继续请求鉴黄接口
|
||||
$basis->curlZip($account_id,$config['domain']);
|
||||
} else {
|
||||
//上传出现错误,返回报错信息
|
||||
$redata = array(
|
||||
"code" => 0,
|
||||
"msg" => $handle->error
|
||||
);
|
||||
echo json_encode($redata);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -93,6 +93,53 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
//新版查询图片
|
||||
function newquery($type,$date = null){
|
||||
//echo $type;
|
||||
//exit;
|
||||
//获取当前时间
|
||||
$thetime = date('Y-m',time());
|
||||
//对时间进行拆分
|
||||
if($date != null){
|
||||
$date = explode("|",$date);
|
||||
|
||||
$starttime = $date[0];
|
||||
$endttime = $date[1];
|
||||
}
|
||||
|
||||
$config = $this->config;
|
||||
$database = $this->database;
|
||||
|
||||
//判断类型
|
||||
switch ($type) {
|
||||
case 'user':
|
||||
// echo 'dsd';
|
||||
$datas = $database->select("imginfo", "*", [
|
||||
"dir" => $config['userdir'],
|
||||
"date[~]" => $thetime,
|
||||
"ORDER" => ["id" => "DESC"]
|
||||
]);
|
||||
// var_dump( $database->log() );
|
||||
// exit;
|
||||
return $datas;
|
||||
break;
|
||||
case 'admin':
|
||||
$datas = $database->select("imginfo", "*", [
|
||||
"dir" => $config['admindir'],
|
||||
"date[~]" => $thetime,
|
||||
"ORDER" => ["id" => "DESC"]
|
||||
]);
|
||||
return $datas;
|
||||
break;
|
||||
default:
|
||||
$sql = "SELECT * FROM imginfo WHERE date(date) BETWEEN '$starttime' AND '$endttime' ORDER BY `id` DESC";
|
||||
|
||||
$datas = $database->query($sql);
|
||||
//var_dump($database->log());
|
||||
return $datas;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//删除一张图片
|
||||
function delete($id){
|
||||
$config = $this->config;
|
||||
|
|
|
@ -143,6 +143,36 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
//返回错误json
|
||||
function re_error($msg){
|
||||
$arr = array(
|
||||
"code" => 0,
|
||||
"msg" => $msg
|
||||
);
|
||||
$rejson = json_encode($arr);
|
||||
echo $rejson;
|
||||
exit;
|
||||
}
|
||||
//请求tipng和鉴黄接口
|
||||
function curlZip($id,$domain){
|
||||
//组合为完整的接口
|
||||
$apiurl = $domain.'dispose.php?id='.$id;
|
||||
//请求接口
|
||||
$curl = curl_init($apiurl);
|
||||
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36");
|
||||
curl_setopt($curl, CURLOPT_FAILONERROR, true);
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
#设置超时时间,最小为1s(可选)
|
||||
curl_setopt($curl , CURLOPT_TIMEOUT, 2);
|
||||
|
||||
@curl_exec($curl);
|
||||
curl_close($curl);
|
||||
//var_dump($html);
|
||||
}
|
||||
}
|
||||
|
||||
//自动初始化完成一些基础操作
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
<?php
|
||||
//载入配置文件
|
||||
include_once("./class/class.user.php");
|
||||
//阻止用户直接访问
|
||||
if( $_SERVER['HTTP_REFERER'] != $config['domain'] )
|
||||
{
|
||||
$basis->re_error('非法请求!');
|
||||
}
|
||||
|
||||
//检查用户是否登录
|
||||
$status = $basis->check($config);
|
||||
|
||||
|
||||
//检查用户是否登陆来判断上传目录
|
||||
if($status == 'islogin') {
|
||||
//设置上传路径
|
||||
|
|
|
@ -1 +1 @@
|
|||
v1.21(20180831)
|
||||
v1.3(20180911)
|
63
index.php
63
index.php
|
@ -6,11 +6,11 @@
|
|||
<div class="layui-container">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-lg12 layui-col-xs12">
|
||||
<div class="msg"><i class="layui-icon"></i> 注意:您上传的图片将会公开显示,勿上传隐私图片。游客限制每天5张,最大支持2M</div>
|
||||
<div class="msg"><i class="layui-icon"></i> 注意:您上传的图片将会公开显示,勿上传隐私图片。游客限制每天10张,最大支持2M</div>
|
||||
<!-- 上传图片表单 -->
|
||||
<div class="layui-upload-drag" id="upimg">
|
||||
<i class="layui-icon"></i>
|
||||
<p>点击上传,或将图片拖拽到此处</p>
|
||||
<p>将图片拖拽到此处,支持Ctrl + V粘贴上传</p>
|
||||
</div>
|
||||
<!-- 上传图片表单END -->
|
||||
</div>
|
||||
|
@ -19,7 +19,7 @@
|
|||
<!-- 图片上传成功 -->
|
||||
<div class="layui-row" id = "upok">
|
||||
<div>
|
||||
<div id="showpic" class = "layui-col-lg5"><a href="" target = "_blank"><img src=""></a></div>
|
||||
<div id="showpic" class = "layui-col-lg5"><a href="" target = "_blank"><img src="./static/loading32.gif"></a></div>
|
||||
<div id="piclink" class = "layui-col-lg6 layui-col-md-offset1">
|
||||
<table class="layui-table" lay-skin="nob">
|
||||
<colgroup>
|
||||
|
@ -55,7 +55,64 @@
|
|||
</div>
|
||||
<!-- 图片上传成功END -->
|
||||
</div>
|
||||
<!--Ctrl + V粘贴上传-->
|
||||
<script>
|
||||
var load1 = document.querySelector("#upimg");
|
||||
|
||||
// 实例化即可
|
||||
new ctrlVUtil({
|
||||
uploadUrl: "functions/cvupload.php",
|
||||
targetElement: load1,
|
||||
isCompleteImg:false,
|
||||
data:{
|
||||
name:"alanzhang",
|
||||
},
|
||||
success:function(data){
|
||||
//转为对象
|
||||
var res = data;
|
||||
//上传成功
|
||||
if(res.code == 1){
|
||||
layer.closeAll('loading');
|
||||
$("#showpic a").attr('href',res.url);
|
||||
$("#showpic img").attr('src',res.url);
|
||||
$("#url").val(res.url);
|
||||
$("#html").val("<img src = '" + res.url + "' />");
|
||||
$("#markdown").val("");
|
||||
$("#bbcode").val("[img]" + res.url + "[/img]");
|
||||
$("#upok").show();
|
||||
//请求接口处理图片
|
||||
$.get("./dispose.php?id="+res.id,function(data,status){
|
||||
var obj = eval('(' + data + ')');
|
||||
if(obj.level == 3){
|
||||
layer.open({
|
||||
title: '温馨提示'
|
||||
,content: '请勿上传违规图片!'
|
||||
});
|
||||
}
|
||||
if(obj.level == null){
|
||||
$.get("./dispose.php?id="+res.id,function(data,status){
|
||||
var obj = eval('(' + data + ')');
|
||||
if(obj.level == 3){
|
||||
layer.open({
|
||||
title: '温馨提示'
|
||||
,content: '请勿上传违规图片!'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
},
|
||||
error: function(error){
|
||||
layer.closeAll('loading');
|
||||
layer.msg('上传失败!');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!--粘贴上传END-->
|
||||
<?php
|
||||
include_once("./tpl/user/footer.php");
|
||||
?>
|
|
@ -195,7 +195,7 @@
|
|||
},
|
||||
error: function(error){
|
||||
layer.closeAll('loading');
|
||||
alert("上传失败!");
|
||||
layer.msg('上传失败!');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -454,7 +454,7 @@ function urlup(){
|
|||
}
|
||||
|
||||
//时间筛选
|
||||
function screen(){
|
||||
function screen(page){
|
||||
var starttime = $("#starttime").val();
|
||||
var endtime = $("#endtime").val();
|
||||
|
||||
|
@ -466,6 +466,6 @@ function screen(){
|
|||
}
|
||||
|
||||
else{
|
||||
window.location.href = "./senioradmin.php?page=1&date=" + starttime + '|' + endtime;
|
||||
window.location.href = page + "?page=1&date=" + starttime + '|' + endtime;
|
||||
}
|
||||
}
|
|
@ -1,2 +1,2 @@
|
|||
/** layui-v2.2.6 MIT License By https://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&& e.attr("lay-src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -4,8 +4,8 @@
|
|||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a href="javascript:;">看图模式<span class="layui-nav-more"></span></a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a href="picadmin.php?type=user&page=1">游客上传</a></dd>
|
||||
<dd><a href="picadmin.php?type=admin&page=1">管理员上传</a></dd>
|
||||
<dd><a href="picadmin.php?type=user">游客上传</a></dd>
|
||||
<dd><a href="picadmin.php?type=admin">管理员上传</a></dd>
|
||||
<dd><a href="smadmin.php?type=preview&page=1">SM.MS</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
|
|
@ -18,6 +18,6 @@
|
|||
<!-- 底部END -->
|
||||
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
|
||||
<script src="./static/layui/layui.js"></script>
|
||||
<script src="./static/embed.js?v=1.2"></script>
|
||||
<script src="./static/embed.js?v=1.3"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -12,8 +12,9 @@
|
|||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="Bookmark" href="favicon.ico" />
|
||||
<link rel="stylesheet" href="./static/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="./static/style.css?v=1.2">
|
||||
<link rel="stylesheet" href="./static/style.css?v=1.3">
|
||||
<script src = "https://libs.xiaoz.top/clipBoard.js/clipBoard.min.js"></script>
|
||||
<script src = "./static/index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 顶部导航栏 -->
|
||||
|
@ -27,8 +28,9 @@
|
|||
<li class="layui-nav-item"><a href="./"><i class="layui-icon"></i> 首页</a></li>
|
||||
<li class="layui-nav-item"><a href="found.php"><i class="layui-icon"></i> 探索发现</a></li>
|
||||
<li class="layui-nav-item"><a href="sm.php"><i class="layui-icon"></i> SM.MS</a></li>
|
||||
<li class="layui-nav-item"><a href="https://doc.xiaoz.me/#/imgurl/api" target = "_blank"><i class="layui-icon"></i> API</a></li>
|
||||
<li class="layui-nav-item"><a href="https://doc.xiaoz.me/docs/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon"></i> 帮助文档</a></li>
|
||||
<li class="layui-nav-item"><a href="https://github.com/helloxz/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon"></i> 源码</a></li>
|
||||
<li class="layui-nav-item"><a href="https://github.com/helloxz/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon"></i> 源码</a></li>
|
||||
<li class="layui-nav-item"><a href="about.php"><i class="layui-icon"></i> 关于</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue