Browse Source

修复设置上传大小不起作用的BUG

master v2.31
xiaoz 5 years ago
parent
commit
b1f1b930e5
  1. 8
      application/controllers/Upload.php
  2. 8
      application/models/Query.php
  3. 6
      application/views/admin/index.php
  4. 11
      application/views/user/header.php
  5. 2
      data/version.txt
  6. 4
      static/embed.js

8
application/controllers/Upload.php

@ -62,6 +62,12 @@ @@ -62,6 +62,12 @@
}
//通用上传设置
protected function config($upload_path = ''){
//获取上传限制
$limit = $this->query->get_limit();
$limit = json_decode($limit);
//最大上传大小
$max_size = $limit->max_size * 1024;
//设置上传路径
if($upload_path == ''){
$upload_path = $this->upload_path;
@ -70,7 +76,7 @@ @@ -70,7 +76,7 @@
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|jpeg|png|bmp|webp';
//$config['allowed_types'] = 'image/jpeg|image/png|image/gif|image/bmp|image/x-ms-bmp|image/webp';
$config['max_size'] = 5120;
$config['max_size'] = $max_size;
$config['file_ext_tolower'] = TRUE; //文件名转换为小写
$config['overwrite'] = TRUE; //覆盖同名文件
$config['encrypt_name'] = TRUE; //随机命名图片

8
application/models/Query.php

@ -364,5 +364,13 @@ @@ -364,5 +364,13 @@
$imginfo = $this->db->query($sql)->row();
return $imginfo;
}
//获取上传限制
public function get_limit(){
$sql = "SELECT `values` FROM img_options WHERE `name` = 'uplimit' LIMIT 1;";
$query = $this->db->query($sql);
//只获取一行
$row = $query->row();
return $row->values;
}
}
?>

6
application/views/admin/index.php

@ -67,6 +67,12 @@ @@ -67,6 +67,12 @@
<p><a href = "//shang.qq.com/wpa/qunwpa?idkey=1994c352ea864ed09a00fd3cfb0f80c946850a70e98551736be69f4253f09136" rel = "nofollow" target = "_blank" title = "加入ImgURL交流群,和大家一起讨论。">341195621</a></p>
</div>
</div>
<div class="layui-col-lg3">
<div class = "analyze">
<h3><i class="fa fa-paypal"></i> 购买专业版</h3>
<p><a href = "https://dwz.ovh/9" rel = "nofollow" target = "_blank" title = "ImgURL Pro专业版,功能更加强大。">https://dwz.ovh/9</a></p>
</div>
</div>
</div>
</div>

11
application/views/user/header.php

@ -44,16 +44,15 @@ @@ -44,16 +44,15 @@
<ul class="layui-nav" lay-filter="">
<li class="layui-nav-item"><a href="/home/multiple"><i class="layui-icon layui-icon-upload"></i> 多图上传</a></li>
<li class="layui-nav-item"><a href="/found"><i class="layui-icon layui-icon-search"></i> 探索发现</a></li>
<li class="layui-nav-item"><a href="/home/log"><i class="layui-icon layui-icon-notice"></i> 更新日志</a></li>
<li class="layui-nav-item"><a href="https://dwz.ovh/9" target="_blank" rel="nofollow"><i class="layui-icon layui-icon-rmb"></i> 购买专业版</a></li>
<li class="layui-nav-item">
<a href="https://dwz.ovh/imgurldoc" target = "_blank" rel = "nofollow"><i class="layui-icon">&#xe705;</i> 帮助文档</a>
<a href="javascript:;" target = "_blank" rel = "nofollow"><i class="layui-icon layui-icon-tabs"></i> 其它选项</a>
<dl class="layui-nav-child"> <!-- 二级菜单 -->
<dd><a href="https://www.xiaoz.me/doc/doc-imgurl/install" rel = "nofollow" target = "_blank">安装ImgURL</a></dd>
<dd><a href="https://www.xiaoz.me/doc/doc-imgurl/api" rel = "nofollow" target = "_blank">ImgURL API</a></dd>
<dd><a href="https://dwz.ovh/imgurldoc" rel = "nofollow" target = "_blank">帮助文档</a></dd>
<dd><a href="/home/log" rel = "nofollow" target = "_blank">更新日志</a></dd>
<dd><a href="https://github.com/helloxz/imgurl" rel = "nofollow" target = "_blank">源码下载</a></dd>
</dl>
</li>
<li class="layui-nav-item"><a href="https://github.com/helloxz/imgurl" target = "_blank" rel = "nofollow"><i class="layui-icon">&#xe635;</i> 源码</a></li>
<li class="layui-nav-item"><a href="/page/use"><i class="layui-icon">&#xe60b;</i> 关于</a></li>
<!-- 简单判断用户是否登录 -->
<?php if((isset($_COOKIE['user'])) && (isset($_COOKIE['token']))){ ?>
<li class="layui-nav-item"><a href="/admin/index"><i class="layui-icon layui-icon-console"></i> 后台管理</a></li>

2
data/version.txt

@ -1 +1 @@ @@ -1 +1 @@
v2.3-20190606
v2.31-20190902

4
static/embed.js

@ -44,7 +44,7 @@ layui.use(['upload','form','element','layer','flow'], function(){ @@ -44,7 +44,7 @@ layui.use(['upload','form','element','layer','flow'], function(){
,accept:'file'
,acceptMime:'image/webp,image/jpeg,image/pjpeg,image/bmp,image/png,image/x-png,image/gif'
,exts: 'jpg|jpeg|png|gif|bmp|webp'
,size:5120
,size:10240
,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading
}
@ -88,7 +88,7 @@ layui.use(['upload','form','element','layer','flow'], function(){ @@ -88,7 +88,7 @@ layui.use(['upload','form','element','layer','flow'], function(){
,acceptMime:'image/webp,image/jpeg,image/pjpeg,image/bmp,image/png,image/x-png,image/gif'
,exts: 'jpg|jpeg|png|gif|bmp|webp'
,multiple:true
,size:5120
,size:10240
,number:5 //可同时上传数量
,before: function(obj){ //上传之前的回调
//清空显示区域

Loading…
Cancel
Save