update 2.4.4

pull/18/head
icret 2022-01-01 15:40:23 +08:00
parent c70b1e72d8
commit 99a526f9e2
15 changed files with 564 additions and 568 deletions

View File

@ -20,40 +20,36 @@
- [x] 支持设置图片指定宽/高
- [x] 支持限制最低宽度/高度上传
- [x] 支持设置广告
- [x] 图片监黄
- [x] 支持开启/关闭api上传
- [x] 在线管理图片(增、删、改、查)
- [x] 支持网站统计 请将统计代码放入:public/static/hm.js
- [x] 更多·····
- [x] 支持自定义
- [x] 支持图片监黄
- [x] 支持API
- [x] 在线管理图片
- [x] 支持网站统计
- [x] 支持更多···
#### 安装文档
#### 使用注意:
[https://www.kancloud.cn/easyimage/easyimage](https://www.kancloud.cn/easyimage/easyimage)
#### 注意:
1. 第一次访问会检查环境并在config目录下生成EasyImage.lock
2. 请将所有文件赋予0755权限或www权限
3. 上传后必须修改config.php的位置
- domain 当前网站域名
- imgurl 当前图片域名
- password 登录管理密码!
4. 如果无法登陆管理界面或上传图片请检查扩展或者使用phpinfo检查。
5. 可以使用浏览器的 F12调试模式->console查看错误
6. 如果对php不太熟悉的话不要将图床程序放置于二级目录
7. 下载源码后可以删除一些文件README.md,LICENSE
8. 欢迎加群:[623688684](https://shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f)
1. 请将所有文件赋予0755权限或www权限
2. 宝塔面板请删除域名文件夹内的user.ini文件
3. 可以使用浏览器的 F12调试模式->console查看错误
4. 如果对php不太熟悉的话不要将图床程序放置于二级目录
5. 第一使用会执行安装程序并生成install.lock如果出错可以删除install目录
6. 网站域名与图片域名必须填写,如果只有一个域名请填写成一样的
7. 安装成功后务必修改默认密码
8. 第一次访问会检查环境并在config目录下生成EasyImage.lock
9. 欢迎加群:[623688684](https://shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f)
#### 安全配置
- Apache配置文件默认设置上传目录不可运行
- Apache环境在上传目录添加配置文件.htaccess使上传目录不可运行PHP程序默认存在)
```Apache
RewriteEngine on RewriteCond % !^$
RewriteRule i/(.*).(php)$ [F]
RewriteRule public/(.*).(php)$ [F]
RewriteRule config/(.*).(php)$ [F]
<FilesMatch "\.(?i:php|php3|php4|php5)">
Order allow,deny
Deny from all
</FilesMatch>
```
- Nginx请在Nginx配置
- Nginx环境限制上传目录禁止运行PHP程序
```Nginx
# 禁止运行php的目录
@ -64,8 +60,31 @@ RewriteRule config/(.*).(php)$ [F]
```
- 或者参考:[https://www.545141.com/981.html](https://www.545141.com/981.html)
#### 帮助文档
[https://www.kancloud.cn/easyimage/easyimage](https://www.kancloud.cn/easyimage/easyimage)
[https://www.kancloud.cn/easyimage/easyimage](简单图床问题反馈)
#### 程序升级
- 保存好config.php文件和上传目录文件
- 如果自定义过API的Token请保存api_key.php文件
- 将新程序下载至网站目录解压覆盖,然后将保存的文件替换既完成升级
<details><summary><mark><font color=darkred>点击查看2.0版更新日志</font></mark></summary>
* 2021-12-25 v2.4.4
- 更改favicon.ico
- 修复缩略图数量统计
- 增加缩略图生成开关
- 日志增加更多文件信息
- 前端增加裁剪和压缩质量
- 上传失败将会输出更多信息
- 修复上传设置中错误和页面显示
- 调整网站设置->上传设置的排序
- 将快捷操作中心转移到网站设置中
- 增加简单图床chrome浏览器插件可自行配置网站->[EasyImage-Browser-Extension](https://github.com/icret/EasyImage-Browser-Extension)
* 2021-11-17 v2.4.3
- 增加登录验证码
- 二级目录安装

View File

@ -5,6 +5,8 @@
require_once __DIR__ . '/../application/function.php';
require_once APP_ROOT . '/application/header.php';
require_once APP_ROOT . '/config/api_key.php';
require_once APP_ROOT . '/api/application/apiFunction.php';
if (!is_online()) {
echo '
@ -27,23 +29,62 @@ if (isset($_POST['form'])) {
';
header("refresh:1;");
}
// 删除非空目录
if (isset($_POST['delDir'])) {
$delDir = APP_ROOT . $config['path'] . $_POST['delDir'];
if (deldir($delDir)) {
echo '
<script> new $.zui.Messager("删除成功!", {type: "success" // 定义颜色主题
}).show();</script>';
header("refresh:1;"); // 1s后刷新当前页面
} else {
echo '
<script> new $.zui.Messager("删除失败!", {type: "danger" // 定义颜色主题
}).show();</script>';
header("refresh:1;"); // 1s后刷新当前页面
}
}
// 查找用户ID或者Token
if (isset($_POST['radio'])) {
if ($_POST['radio'] == 'id') {
$radio_value = '用户token' . getIDToken($_POST['radio-value']);
} elseif ($_POST['radio'] == 'token') {
$radio_value = '用户ID' . getID($_POST['radio-value']);
} else {
$radio_value = null;
}
}
?>
<div class="container">
<div class="row">
<div class="col-xs-3">
<ul class="nav nav-tabs nav-stacked">
<li class="active"><a href="###" data-target="#tab3Content1" data-toggle="tab">网站设置</a></li>
<li><a href="###" data-target="#tab3Content2" data-toggle="tab">上传设置</a></li>
<li><a href="###" data-target="#tab3Content3" data-toggle="tab">拓展设置</a></li>
<li><a href="###" data-target="#tab3Content4" data-toggle="tab">API 设置</a></li>
<li><a href="###" data-target="#tab3Content5" data-toggle="tab">安全设置</a></li>
<div class="col-md-12 alert alert-primary alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h5>目录保存以 /// 递进,非必要请勿修改!否则会导致部分操作不可用;</h5>
<h5>本人仅为程序开源创作,如非法网站使用与本人无关,请勿用于非法用途;</h5>
<h5>请为本人博客<a class="alert-link" href="https://www.545141.com/" target="_blank">www.545141.com</a>加上网址链接,谢谢支持。作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中相关来源信息(例如:<a class="alert-link" href="https://www.545141.com/">本人博客</a>,邮箱等)。</h5>
<p>
<a href="https://img.545141.com/" target="_blank"><button type="button" class="btn btn-success btn-mini"><i class="icon icon-unlink"></i> 演示网站</button></a>
<a href="https://support.qq.com/products/367633" target="_blank"><button type="button" class="btn btn-primary btn-mini"><i class="icon icon-bug"></i> 问题反馈</button></a>
<button type="button" class="btn btn-danger btn-mini" data-scroll-inside="true" data-moveable="true" data-width="300px" data-height="250px" data-icon="heart" data-title="您的赞美是我开发的动力!" data-iframe="https://img.545141.com/sponsor/index.html" data-toggle="modal"><i class="icon icon-heart-empty"></i> 打赏作者</button>
</p>
</div>
<div class="col-xs-2">
<ul class="nav nav-tabs nav-stacked" id="tabC">
<li class="active"><a data-tab href="#Content1">网站设置</a></li>
<li><a data-tab href="#Content2">上传设置</a></li>
<li><a data-tab href="#Content7">违规图片</a></li>
<li><a data-tab href="#Content4">文件操作</a></li>
<li><a data-tab href="#Content5">API/Token</a></li>
<li><a data-tab href="#Content3">拓展设置</a></li>
<li><a data-tab href="#Content6">安全设置</a></li>
<li><a data-tab href="#Content8">系统信息</a></li>
</ul>
</div>
<div class="col-xs-9">
<div class="tab-content col-xs-9">
<div class="tab-pane fade active in" id="tab3Content1">
<div class="tab-pane fade active in" id="Content1">
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<label>网站域名,末尾不加"/" </label>
@ -99,7 +140,7 @@ if (isset($_POST['form'])) {
<button type="submit" class="btn btn-primary">保存</button>
</form>
</div>
<div class="tab-pane fade" id="tab3Content2">
<div class="tab-pane fade" id="Content2">
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<div class="switch">
@ -119,10 +160,14 @@ if (isset($_POST['form'])) {
<label>存储路径 例:/i/ 前后需加英文'/'</label>
<input type="text" class="form-control" name="path" required="required" value="<?php echo $config['path']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')" title="可根据Apache/Nginx配置安全参考https://www.545141.com/981.html 或 README.md">
</div>
<div class="form-group">
<label>允许上传的图片扩展名,请以英文,分割</label>
<input type="text" class="form-control" name="extensions" required="required" value="<?php echo $config['extensions']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div>
<div class="form-group">
<label>文件的命名方式</label>
<select class="chosen-select form-control" name="imgName">
<option value="default" <?php if ($config['imgName'] == 'default') {echo 'selected';} ?>>将上传时间+随机数转换为36进制 例vx77yu</option>
<option value="default" <?php if ($config['imgName'] == 'default') {echo 'selected';} ?>>默认 - 将上传时间+随机数转换为36进制 例vx77yu</option>
<option value="date" <?php if ($config['imgName'] == 'date') {echo 'selected';} ?>>以上传时间 例192704</option>
<option value="unix" <?php if ($config['imgName'] == 'unix') {echo 'selected';} ?>>以Unix时间 例1635074840</option>
<option value="uniqid" <?php if ($config['imgName'] == 'uniqid') {echo 'selected';} ?>>基于以微秒计的当前时间 例6175436c73418</option>
@ -132,15 +177,21 @@ if (isset($_POST['form'])) {
</select>
</div>
<div class="form-group">
<label>最大上传限制最小1MB最大50MB当前</label><label id="maxSize"><?php echo $config['maxSize'] / 1024 / 1024; ?></label><label>MB</label>
<input type="range" class="form-control" name="maxSize" value="<?php echo $config['maxSize']; ?>" min="1048576" max="52428800" step="1048576" onchange="document.getElementById('maxSize').innerHTML=value/1024/1024">
<label>转换图片为指定格式<?php echo $config['imgConvert']; ?></label>
<select class="chosen-select form-control" name="imgConvert">
<option value="" <?php if (empty($config['imgConvert'])) {echo 'selected';} ?>>不转换</option>
<option value="png" <?php if ($config['imgConvert']=='png') {echo 'selected';} ?>>png</option>
<option value="jpeg"<?php if ($config['imgConvert']=='jpeg') {echo 'selected';} ?>>jpeg</option>
<option value="gif" <?php if ($config['imgConvert']=='gif') {echo 'selected';} ?>>gif</option>
<option value="bmp" <?php if ($config['imgConvert']=='bmp') {echo 'selected';} ?>>bmp</option>
</select>
</div>
<div class="form-group">
<label>每次最多上传图片数,当前:</label><label id="maxUploadFiles"><?php echo $config['maxUploadFiles']; ?></label><label>张</label>
<label>次最多上传图片数,当前:</label><label id="maxUploadFiles"><?php echo $config['maxUploadFiles']; ?></label><label>张</label>
<input type="range" class="form-control" name="maxUploadFiles" value="<?php echo $config['maxUploadFiles']; ?>" min="1" max="100" step="1" onchange="document.getElementById('maxUploadFiles').innerHTML=value">
</div>
<div class="form-group">
<label>上传水印</label>
<label>水印方式</label>
<select class="chosen-select form-control" name="watermark">
<option value="0" <?php if (!$config['watermark']) {echo 'selected';} ?>>关闭水印</option>
<option value="1" <?php if ($config['watermark'] == 1) {echo 'selected';} ?>>文字水印</option>
@ -151,20 +202,6 @@ if (isset($_POST['form'])) {
<label>水印文字内容</label>
<input type="text" class="form-control" name="waterText" required="required" value="<?php echo $config['waterText']; ?>" onkeyup="this.value=this.value.trim()">
</div>
<div class="form-group">
<label>水印位置:</label>
<select class="chosen-select form-control" name="waterPosition">
<option value="0" <?php if (!$config['waterPosition']) {echo 'selected';} ?>>随机位置</option><option value="1" <?php if ($config['waterPosition'] == 1) {echo 'selected';} ?>>顶部居左</option>
<option value="2" <?php if ($config['waterPosition'] == 2) {echo 'selected';} ?>>顶部居中</option>
<option value="3" <?php if ($config['waterPosition'] == 3) {echo 'selected';} ?>>顶部居右</option>
<option value="4" <?php if ($config['waterPosition'] == 4) {echo 'selected';} ?>>左边居中</option>
<option value="5" <?php if ($config['waterPosition'] == 5) {echo 'selected';} ?>>图片中心</option>
<option value="6" <?php if ($config['waterPosition'] == 6) {echo 'selected';} ?>>右边居中</option>
<option value="7" <?php if ($config['waterPosition'] == 7) {echo 'selected';} ?>>底部居左</option>
<option value="8" <?php if ($config['waterPosition'] == 8) {echo 'selected';} ?>>底部居中</option>
<option value="9" <?php if ($config['waterPosition'] == 9) {echo 'selected';} ?>>底部居右</option>
</select>
</div>
<div class="form-group">
<label>水印文字颜色 rgba 末尾为透明度0-127 0为不透明</label>
<input type="text" name="textColor" class="form-control" value="" readonly data-jscolor="{value:'rgba(<?php echo $config['textColor']; ?>)', position:'bottom', height:80, backgroundColor:'#333',palette:'rgba(0,0,0,0) #fff #808080 #000 #996e36 #f55525 #ffe438 #88dd20 #22e0cd #269aff #bb1cd4',paletteCols:11, hideOnPaletteClick:true}">
@ -182,68 +219,93 @@ if (isset($_POST['form'])) {
<input type="text" class="form-control" name="waterImg" required="required" value="<?php echo $config['waterImg']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div>
<div class="form-group">
<label>允许上传的图片扩展名,请以英文,分割</label>
<input type="text" class="form-control" name="extensions" required="required" value="<?php echo $config['extensions']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')">
<label>水印位置:</label>
<select class="chosen-select form-control" name="waterPosition">
<option value="0" <?php if (!$config['waterPosition']) {echo 'selected';} ?>>随机位置</option><option value="1" <?php if ($config['waterPosition'] == 1) {echo 'selected';} ?>>顶部居左</option>
<option value="2" <?php if ($config['waterPosition'] == 2) {echo 'selected';} ?>>顶部居中</option>
<option value="3" <?php if ($config['waterPosition'] == 3) {echo 'selected';} ?>>顶部居右</option>
<option value="4" <?php if ($config['waterPosition'] == 4) {echo 'selected';} ?>>左边居中</option>
<option value="5" <?php if ($config['waterPosition'] == 5) {echo 'selected';} ?>>图片中心</option>
<option value="6" <?php if ($config['waterPosition'] == 6) {echo 'selected';} ?>>右边居中</option>
<option value="7" <?php if ($config['waterPosition'] == 7) {echo 'selected';} ?>>底部居左</option>
<option value="8" <?php if ($config['waterPosition'] == 8) {echo 'selected';} ?>>底部居中</option>
<option value="9" <?php if ($config['waterPosition'] == 9) {echo 'selected';} ?>>底部居右</option>
</select>
</div>
<div class="form-group">
<div class="switch">
<input type="hidden" name="compress" value="0">
<input type="checkbox" name="compress" value="1" <?php if ($config['compress']) {echo 'checked="checked"';} ?> title=" 轻微有损压缩图片, 此压缩有可能使图片变大!特别是小图片 也有一定概率改变图片方向">
<label style="font-weight: bold">开启压缩图片-开启后会增加服务器负担</label>
<label style="font-weight: bold">开启压缩图片-会增加服务器负担</label>
</div>
</div>
<div class="form-group">
<label>转换图片为指定格式<?php echo $config['imgConvert']; ?></label>
<select class="chosen-select form-control" name="imgConvert">
<option value="">不转换</option>
<option value="png">png</option>
<option value="jpeg">jpeg</option>
<option value="gif">gif</option>
<option value="bmp">bmp</option>
</select>
<div class="switch">
<input type="hidden" name="thumbnail" value="0">
<input type="checkbox" name="thumbnail" value="1" <?php if ($config['thumbnail']) {echo 'checked="checked"';} ?> title=" 开启缩略图后会影响前端上传速度和服务器开销">
<label style="font-weight: bold">开启缩略图-会影响前端上传速度和服务器开销</label>
</div>
</div>
<div class="form-group">
<label>最大上传宽度</label>
<label>最大上传宽度->更改后的宽度:</label><label id="maxWidth"><?php echo $config['maxWidth']; ?></label><label>像素</label>
<input type="range" class="form-control" name="maxWidth" value="<?php echo $config['maxWidth']; ?>" min="1024" max="102400" step="1024" onchange="document.getElementById('maxWidth').innerHTML=value">
<label id="maxWidth"><?php echo $config['maxWidth']; ?></label><label>像素</label>
</div>
<div class="form-group">
<label>最大上传高度</label>
<label>最大上传高度->更改后的高度:</label><label id="maxHeight"><?php echo $config['maxHeight']; ?></label><label>像素</label>
<input type="range" class="form-control" name="maxHeight" value="<?php echo $config['maxHeight']; ?>" min="1024" max="102400" step="1024" onchange="document.getElementById('maxHeight').innerHTML=value">
<label id="maxHeight"><?php echo $config['maxHeight']; ?></label><label>像素</label>
</div>
<div class="form-group">
<label>允许上传的最小宽度</label>
<label>单文件最大上传大小(1MB-50MB)->更改后的限制:</label><label id="maxSize"><?php echo $config['maxSize'] / 1024 / 1024; ?></label><label>MB</label>
<input type="range" class="form-control" name="maxSize" value="<?php echo $config['maxSize']; ?>" min="1048576" max="52428800" step="1048576" onchange="document.getElementById('maxSize').innerHTML=value/1024/1024">
</div>
<div class="form-group">
<label>允许上传的最小宽度->更改后的宽度:</label><label id="minWidth"><?php echo $config['minWidth']; ?></label><label>像素</label>
<input type="range" class="form-control" name="minWidth" value="<?php echo $config['minWidth']; ?>" min="5" max="1024" step="10" onchange="document.getElementById('minWidth').innerHTML=value">
<label id="minWidth"><?php echo $config['minWidth']; ?></label><label>像素</label>
</div>
<div class="form-group">
<label>允许上传的最小高度</label>
<label>允许上传的最小高度->更改后的高度:</label><label id="minHeight"><?php echo $config['minHeight']; ?></label><label>像素</label>
<input type="range" class="form-control" name="minHeight" value="<?php echo $config['minHeight']; ?>" min="5" max="1024" step="10" onchange="document.getElementById('minHeight').innerHTML=value">
<label id="minHeight"><?php echo $config['minHeight']; ?></label><label>像素</label>
</div>
<div class="form-group">
<div class="switch">
<input type="hidden" name="imgRatio" value="0">
<input type="checkbox" name="imgRatio" value="1" <?php if ($config['imgRatio']) {echo 'checked="checked"';} ?>>
<label style="font-weight: bold">开启上传后改变图片尺寸(不开启下边不会生效!</label>
<label style="font-weight: bold">开启上传前修改图片(控制以下五项</label>
</div>
</div>
<div class="form-group">
<label>开启上传后改变图片尺寸->更改后的宽度:</label><label id="image_x"><?php echo $config['image_x']; ?></label><label>像素</label>
<label>上传前改变图片尺寸->更改后的宽度:</label><label id="image_x"><?php echo $config['image_x']; ?></label><label>像素</label>
<input type="range" class="form-control" name="image_x" value="<?php echo $config['image_x']; ?>" min="100" max="10240" step="100" onchange="document.getElementById('image_x').innerHTML=value">
</div>
<div class="form-group">
<label>开启上传后改变图片尺寸->更改后的高度:</label><label id="image_y"><?php echo $config['image_y']; ?></label><label>像素</label>
<label>上传前改变图片尺寸->更改后的高度:</label><label id="image_y"><?php echo $config['image_y']; ?></label><label>像素</label>
<input type="range" class="form-control" name="image_y" value="<?php echo $config['image_y']; ?>" min="100" max="10240" step="100" onchange="document.getElementById('image_y').innerHTML=value">
</div>
<div class="form-group">
<div class="switch">
<input type="hidden" name="imgRatio_crop" value="0">
<input type="checkbox" name="imgRatio_crop" value="1" <?php if ($config['imgRatio_crop']) {echo 'checked="checked"';} ?>>
<label style="font-weight: bold">开启上传前裁剪</label>
</div>
</div>
<div class="form-group">
<div class="switch">
<input type="hidden" name="imgRatio_preserve_headers" value="0">
<input type="checkbox" name="imgRatio_preserve_headers" value="1" <?php if ($config['imgRatio_preserve_headers']) {echo 'checked="checked"';} ?>>
<label style="font-weight: bold">压缩后是否保留图片原始数据</label>
</div>
</div>
<div class="form-group">
<label>上传前图片压缩率控制(仅支持JPG)->更改后的压缩率:</label><label id="imgRatio_quality"><?php echo $config['imgRatio_quality']; ?></label><label>%</label>
<input type="range" class="form-control" name="imgRatio_quality" value="<?php echo $config['imgRatio_quality']; ?>" min="10" max="100" step="5" onchange="document.getElementById('imgRatio_quality').innerHTML=value">
</div>
<div class="form-group">
<input type="hidden" class="form-control" name="form" value="" placeholder="隐藏的保存">
</div>
<button type="submit" class="btn btn-primary">保存</button>
</form>
</div>
<div class="tab-pane fade" id="tab3Content3">
<div class="tab-pane fade" id="Content3">
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<div class="switch">
@ -277,19 +339,91 @@ if (isset($_POST['form'])) {
<button type="submit" class="btn btn-primary">保存</button>
</form>
</div>
<div class="tab-pane fade " id="tab3Content4">
<div class="tab-pane fade " id="Content4">
<p>
<form class="form-inline" method="get" action="../application/del.php" id="form" name="delForm" onSubmit="getStr();" target="_blank">
<p id="delimgurl"></p>
<div class="form-group">
<label for="del">删除单张图片文件:</label>
<input type="url" name="url" class="form-control" id="del" placeholder="请输入图片链接">
</div>
<button type="submit" class="btn btn-primary" onClick="return confirm('确认要删除?\n* 删除文件后将无法恢复!');">删除单文件</button>
</form>
</p>
<p>
<form class="form-inline" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<label for="delDir" style="color:red">删除指定日期文件:</label>
<input type="text" class="form-control form-date" name="delDir" value="<?php echo date('Y/m/d/'); ?>" readonly="">
</div>
<button type="submit" class="btn btn-danger" onClick="return confirm('确认要删除?\n* 删除文件夹后将无法恢复!');">删除文件夹</button>
</form>
</p>
<form class="form-inline" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
<span class="label label-primary label-outline">已缓存文件:<?php echo getFileNumber(APP_ROOT . $config['path'] . 'thumb/'); ?>占用<?php echo getDistUsed(getDirectorySize(APP_ROOT . $config['path'] . 'thumb/')); ?></span>
<button type="submit" class="btn btn-primary" name="delDir" value="thumb/" onClick="return confirm('确认要清理缓存?\n* 删除文件夹后将无法恢复!');">清理缓存</button>
</form>
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<label>TinyImag Key 申请地址:<a href="https://tinypng.com/developers" target="_blank">https://tinypng.com/developers</a></label>
<input type="text" class="form-control input-sm" name="TinyImag_key" value="<?php echo $config['TinyImag_key']; ?>" title="开启后会受服务器到https://tinypng.com 速度影响,国内不建议开启!" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div>
<div class="form-group">
<input type="hidden" class="form-control" name="form" value="" placeholder="隐藏的保存">
</div>
<button type="submit" class="btn btn-primary">保存</button>
<div class="form-group">
<label>利用Tinypng压缩图片 TinyImag Key 申请地址:<a href="https://tinypng.com/developers" target="_blank">https://tinypng.com/developers</a></label>
<input type="text" class="form-control input-sm" name="TinyImag_key" value="<?php echo $config['TinyImag_key']; ?>" title="开启后会受服务器到https://tinypng.com 速度影响,国内不建议开启!" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div>
<div class="form-group">
<input type="hidden" class="form-control" name="form" value="" placeholder="隐藏的保存">
</div>
<button type="submit" class="btn btn-primary">保存</button>
</form>
<p>
<form action="../application/compressing.php" method="post" target="_blank">
<div class="form-group">
<label for="exampleInputInviteCode1">压缩文件夹内图片(格式2021/05/10/)</label>
<input type="text" class="form-control form-date" placeholder="" name="folder" value="<?php echo date('Y/m/d/'); ?>" readonly="">
</div>
<div class="radio">
<label><input type="radio" name="type" value="Imgcompress" checked="checked"> 使用本地压缩(默认上传已压缩,不需重复压缩)</label>
</div>
<div class="radio">
<label><input type="radio" name="type" value="TinyImg"> 使用TinyImag压缩需要申请key) </label>
</div>
<div>
<label>* 如果页面长时间没有响应,表示正面正在压缩!</label>
<label>两种压缩均为不可逆,并且非常占用硬件资源。</label>
</div>
<button type="submit" class="btn btn-mini btn-success">开始压缩</button>
</form>
</p>
</div>
<div class="tab-pane fade" id="tab3Content5">
<div class="tab-pane fade " id="Content5">
<b>生成Token 新Token需按要求填入<code>/config/api_key.php</code>才生效</b>
<form class="form-condensed" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="input-group">
<span class="input-group-addon">Generate token</span>
<input type="text" class="form-control" id="exampleInputMoney1" value="<?php echo privateToken(); ?>">
</div>
</form>
<p>
<table class="table table-hover table-bordered table-condensed table-responsive">
<thead>
<tr>
<th>当前可用Token列表</th>
</tr>
</thead>
<tbody>
<?php foreach ($tokenList as $value) {echo '<tr><td>' . $value . '</td></tr>';}?>
</tbody>
</table>
</p>
<form class="form-condensed" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<label for="exampleInputAccount6">根据ID/Token查找用户信息</label>
<input type="text" name="radio-value" id="exampleInputAccount6" class="form-control" placeholder="输入信息" value="<?php echo @$radio_value; ?>">
<div class="radio-primary"><input type="radio" name="radio" value="id" id="primaryradio1" checked="checked"><label for="primaryradio1">根据ID查找用户Token</label></div>
<div class="radio-primary"><input type="radio" name="radio" value="token" id="primaryradio2"><label for="primaryradio2">根据Token查找用户ID</label></div>
<button type="submit" class="btn btn-mini btn-primary">查找</button>
</div>
</form>
</div>
<div class="tab-pane fade" id="Content6">
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<div class="switch">
@ -337,7 +471,7 @@ if (isset($_POST['form'])) {
<input type="checkbox" name="upload_logs" value="1" <?php if ($config['upload_logs']) {echo 'checked="checked"';} ?> title="日志每月保存一个文件;经过测试每月二十万条数据并不影响速度!">
<label style="font-weight: bold">开启上传日志</label>
</div>
</div>
</div>
<div class="form-group">
<p style="font-weight: bold">
当前版本:<span class="label label-badge label-outline"><?php echo $config['version']; ?></span>
@ -350,6 +484,98 @@ if (isset($_POST['form'])) {
<button type="submit" class="btn btn-primary">保存</button>
</form>
</div>
<div class="tab-pane fade" id="Content7">
<p>为了访问速度仅显示最近20张图片监黄需要在安全设置->开启图片监黄。</p>
<p>key申请地址<a href="https://client.moderatecontent.com/" target="_blank">https://client.moderatecontent.com/</a></p>
<p>获得key后填入安全设置->图片监黄key </p>
<table class="table table-hover table-bordered table-auto table-condensed table-striped">
<thead>
<tr>
<th>序号</th>
<th>缩略图</th>
<th>文件名</th>
<th>大小</th>
<th>查看图片</th>
<th>还原图片</th>
<th>删除图片</th>
</tr>
</thead>
<tbody>
<?php
// 获取被隔离的文件
@$cache_dir = APP_ROOT . $config['path'] . 'suspic/'; // cache目录
@$cache_file = getFile($cache_dir); // 获取所有文件
@$cache_num = count($cache_file); // 统计目录文件个数
for ($i = 0; $i < $cache_num and $i < 21; $i++) { // 循环输出文件
$file_cache_path = APP_ROOT . $config['path'] . 'suspic/' . $cache_file[$i]; // 图片绝对路径
$file_path = $config['path'] . 'suspic/' . $cache_file[$i]; // 图片相对路径
@$file_size = getDistUsed(filesize($file_cache_path)); // 图片大小
@$filen_name = $cache_file[$i]; // 图片名称
$url = $config['imgurl'] . $config['path'] . 'suspic/' . $cache_file[$i]; // 图片网络连接
$unlink_img = $config['domain'] . '/application/del.php?url=' . $url; // 图片删除连接
// 缩略图文件
$thumb_cache_file = $config['domain'] . '/application/thumb.php?img=' . $file_path . '&width=300&height=300';
echo '
<tr>
<td>' . $i . '</td>
<td><img data-toggle="lightbox" src="' . $thumb_cache_file . '" data-image="' . $thumb_cache_file . '" class="img-thumbnail" ></td>
<td>' . $filen_name . '</td>
<td>' . $file_size . '</td>
<td><a class="btn btn-mini" href="' . $url . '" target="_blank">查看原图</a></td>
<td><a class="btn btn-mini btn-success" href="?reimg=' . $filen_name . '">恢复图片</a></td>
<td><a class="btn btn-mini btn-danger" href="' . $unlink_img . '" target="_blank">删除图片</a></td>
</tr>
';
}
?>
</tbody>
</table>
<form class="form-inline" action="<?php $_SERVER['SCRIPT_NAME'];?>" method="post">
<span>总数:<?php echo $cache_num;?>张</span>
<input class="form-control" type="hidden" name="delDir" value="/suspic/" readonly="">
<button class="btn btn-danger btn-mini" ">删除全部违规图片</button>
</form>
</div>
<div class="tab-pane fade" id="Content8">
<div class="alert alert-primary">
<h5>系统信息</h5>
<hr />
<p>服务器系统:<?PHP echo php_uname('s') . ' <small class="text-muted">' . php_uname() . '</small>'; ?></p>
<p>WEB服务<?PHP echo $_SERVER['SERVER_SOFTWARE']; ?></p>
<p>服务器IP<?PHP echo GetHostByName($_SERVER['SERVER_NAME']) ?></p>
<p>系统时间:<?PHP echo date("Y-m-d G:i:s"); ?></p>
<p>已用空间:<?php echo getDistUsed(disk_total_space(__DIR__) - disk_free_space(__DIR__)) . ' 剩余空间:' . getDistUsed(disk_free_space(__DIR__)); ?></p>
<h5>PHP信息</h5>
<hr />
<p>PHP版本<?php echo phpversion(); ?></p>
<p>GD版本<?php echo (gd_info()["GD Version"]); ?></p>
<p>PHP上传限制<?PHP echo get_cfg_var("upload_max_filesize"); ?></p>
<p>POST上传限制<?php echo ini_get('post_max_size'); ?></p>
<p>PHP最长执行时间<?PHP echo get_cfg_var("max_execution_time") . ""; ?></p>
<p>PHP允许占用内存<?PHP echo get_cfg_var("memory_limit") . "M "; ?></p>
<h5>我的信息</h5>
<hr />
<p>浏览器:<?php echo $_SERVER['HTTP_USER_AGENT']; ?></p>
<p>我的IP<?php echo $_SERVER["REMOTE_ADDR"]; ?></p>
<h5>图床信息</h5>
<hr />
<p><?php
if (empty($config['TinyImag_key'])) {
echo '压缩图片 TinyImag Key未填写申请地址<a href="https://tinypng.com/developers" target="_blank">https://tinypng.com/developers</a><br/>';
} else {
echo '压缩图片 TinyImag Key已填写<br/>';
}
if (empty($config['moderatecontent_key'])) {
echo '图片检查 moderatecontent key未填写申请地址 <a href="https://client.moderatecontent.com" target="_blank">https://client.moderatecontent.com/</a>';
} else {
echo '图片检查 moderatecontent key已填写';
}
?>
</p>
<p>当前版本:<?php echo $config['version']; ?>Github版本<a href="https://github.com/icret/EasyImages2.0/releases" target="_blank"><?php echo getVersion(); ?></a></p>
</div>
</div>
</div>
</div>
</div>
@ -357,10 +583,13 @@ if (isset($_POST['form'])) {
</div>
<script type="text/javascript" src="<?php static_cdn(); ?>/public/static/jscolor.js"></script>
<link href="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.css" rel="stylesheet">
<script src="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<script>
// 密码隐藏
var eye = document.getElementById("eye");
var pwd = document.getElementById("pwd");
function showhide() {
if (pwd.type == "password") {
pwd.type = "text";
@ -382,8 +611,39 @@ if (isset($_POST['form'])) {
//paletteCols: 12,
//hideOnPaletteClick: true,
};
// 动态显示要删除的图片
var oBtn = document.getElementById('del');
var oTi = document.getElementById('title');
if ('oninput' in oBtn) {
oBtn.addEventListener("input", getWord, false);
} else {
oBtn.onpropertychange = getWord;
}
function getWord() {
var delimgurl = document.getElementById("delimgurl");
delimgurl.innerHTML += '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
// 日期选择
$(".form-date").datetimepicker({
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
minView: 2,
forceParse: 0,
format: "yyyy/mm/dd/"
});
// 更改网页标题
document.title = "配置中心 - EasyImage2.0 简单图床"
$('[data-tab]').on('shown.zui.tab', function(e) {
console.clear()
console.log('当前被激活的标签页', e.target);
console.log('上一个标签页', e.relatedTarget);
});
</script>
<?php
require_once APP_ROOT . '/application/footer.php';

View File

@ -90,7 +90,7 @@ if (is_array($char_data)) {
<div class="col-md-2 alert alert-primary autoshadow">
缓存文件
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'thumb/')); ?>
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'thumbnails/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
可疑图片

View File

@ -1,302 +0,0 @@
<?php
/*
* 快捷操作中心页面
*/
require_once '../application/header.php';
require_once APP_ROOT . '/config/api_key.php';
require_once APP_ROOT . '/api/application/apiFunction.php';
// 检测登录
if (!is_online()) {
checkLogin();
}
// 查找用户ID或者Token
if (isset($_POST['radio'])) {
if ($_POST['radio'] == 'id') {
$radio_value = '用户token' . getIDToken($_POST['radio-value']);
} elseif ($_POST['radio'] == 'token') {
$radio_value = '用户ID' . getID($_POST['radio-value']);
} else {
$radio_value = null;
}
}
// 删除非空目录
if (isset($_POST['delDir'])) {
$delDir = APP_ROOT . $config['path'] . $_POST['delDir'];
if (deldir($delDir)) {
echo '
<script> new $.zui.Messager("删除成功!", {type: "success" // 定义颜色主题
}).show();</script>';
header("refresh:1;"); // 1s后刷新当前页面
} else {
echo '
<script> new $.zui.Messager("删除失败!", {type: "danger" // 定义颜色主题
}).show();</script>';
header("refresh:1;"); // 1s后刷新当前页面
}
}
// 恢复图片
if (isset($_GET['reimg'])) {
$name = $_GET['reimg'];
re_checkImg($name);
}
?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="alert alert-primary">
<h3 style="text-align:center">EasyImage2.0 快捷操作中心</h3>
<hr />
<h5>目录保存以 /// 递进,非必要请勿修改!否则会导致部分操作不可用;</h5>
<h5>本人仅为程序开源创作,如非法网站使用与本人无关,请勿用于非法用途;</h5>
<h5>请为本人博客<a href="https://www.545141.com/" target="_blank">www.545141.com</a>加上网址链接,谢谢支持。作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中相关来源信息(例如:本人博客,邮箱等)。</h5>
<p>
<button type="button" class="btn btn-mini" data-toggle="collapse" data-target="#collapseExample">服务信息<i class="icon icon-hand-down"></i></button>
<a href="https://img.545141.com/sponsor/index.html" target="_blank"><button type="button" class="btn btn-danger btn-mini">打赏作者 <i class="icon icon-heart-empty"></i></button></a>
</p>
<div class="collapse" id="collapseExample">
<div class="bg-danger with-padding">
<h5>系统信息</h5>
<hr />
<p>服务器系统:<?PHP echo php_uname('s') . ' <small class="text-muted">' . php_uname() . '</small>'; ?></p>
<p>WEB服务<?PHP echo $_SERVER['SERVER_SOFTWARE']; ?></p>
<p>服务器IP<?PHP echo GetHostByName($_SERVER['SERVER_NAME']) ?></p>
<p>系统时间:<?PHP echo date("Y-m-d G:i:s"); ?></p>
<p>已用空间:<?php echo getDistUsed(disk_total_space(__DIR__) - disk_free_space(__DIR__)) . ' 剩余空间:' . getDistUsed(disk_free_space(__DIR__)); ?></p>
<h5>PHP信息</h5>
<hr />
<p>PHP版本<?php echo phpversion(); ?></p>
<p>GD版本<?php echo (gd_info()["GD Version"]); ?></p>
<p>PHP上传限制<?PHP echo get_cfg_var("upload_max_filesize"); ?></p>
<p>POST上传限制<?php echo ini_get('post_max_size'); ?></p>
<p>PHP最长执行时间<?PHP echo get_cfg_var("max_execution_time") . ""; ?></p>
<p>PHP允许占用内存<?PHP echo get_cfg_var("memory_limit") . "M "; ?></p>
<h5>我的信息</h5>
<hr />
<p>浏览器:<?php echo $_SERVER['HTTP_USER_AGENT']; ?></p>
<p>访问者IP<?php echo $_SERVER["REMOTE_ADDR"]; ?></p>
<h5>图床信息</h5>
<hr />
<p><?php
if (empty($config['TinyImag_key'])) {
echo '压缩图片 TinyImag Key未填写申请地址<a href="https://tinypng.com/developers" target="_blank">https://tinypng.com/developers</a><br/>';
} else {
echo '压缩图片 TinyImag Key已填写<br/>';
}
if (empty($config['moderatecontent_key'])) {
echo '图片检查 moderatecontent key未填写申请地址 <a href="https://client.moderatecontent.com" target="_blank">https://client.moderatecontent.com/</a>';
} else {
echo '图片检查 moderatecontent key已填写';
}
?>
</p>
<p>当前版本:<?php echo $config['version']; ?>Github版本<a href="https://github.com/icret/EasyImages2.0/releases" target="_blank"><?php echo getVersion(); ?></a></p>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<form class="form-condensed" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
<label for="exampleInputMoney1">
新Token需按要求填入
<code>/config/api_key.php</code>
才生效
</label>
<div class="input-group">
<span class="input-group-addon">
New Token
</span>
<input type="text" class="form-control" id="exampleInputMoney1" value="<?php echo privateToken(); ?>">
</div>
</div>
<div class="col-md-4">
<form></form>
<form class="form-condensed" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<label for="exampleInputAccount6">根据ID/Token查找用户信息</label>
<input type="text" name="radio-value" id="exampleInputAccount6" class="form-control" placeholder="输入信息" value="<?php echo @$radio_value; ?>">
<div class="radio-primary"><input type="radio" name="radio" value="id" id="primaryradio1" checked="checked"><label for="primaryradio1">根据ID查找用户Token</label></div>
<div class="radio-primary"><input type="radio" name="radio" value="token" id="primaryradio2"><label for="primaryradio2">根据Token查找用户ID</label></div>
<button type="submit" class="btn btn-mini btn-primary">
查找
</button>
</div>
</form>
</div>
<div class="col-md-4">
<div id="delimgurl"></div>
<div id="title"></div>
<form class="form-condensed" method="get" action="../application/del.php" id="form" name="delForm" onSubmit="getStr();" target="_blank">
<div class="form-group">
<label for="del">
删除图片
</label>
<input type="url" name="url" class="form-control" id="del" placeholder="请输入图片链接" />
</div>
<label>格式:<code>https://i1.100024.xyz/i/2021/05/04/10fn9ei.jpg</code></label>
<input type="submit" class="btn btn-mini btn-primary" value="删除" />
</form>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<form action="../application/compressing.php" method="post" target="_blank">
<div class="form-group">
<label for="exampleInputInviteCode1">压缩文件夹内图片(格式2021/05/10/)</label>
<input type="text" class="form-control form-date" placeholder="" name="folder" value="<?php echo date('Y/m/d/'); ?>" readonly="">
</div>
<div class="radio">
<label>
<input type="radio" name="type" value="Imgcompress" checked="checked"> 使用本地压缩(默认上传已压缩,不需重复压缩)
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="type" value="TinyImg"> 使用TinyImag压缩需要申请key)
</label>
</div>
<div>
<label>
* 如果页面长时间没有响应,表示正面正在压缩!
</label>
<label>
两种压缩均为不可逆,并且非常占用硬件资源。
</label>
</div>
<button type="submit" class="btn btn-mini btn-success">开始压缩</button>
</form>
</div>
<div class="col-md-4">
<table class="table table-hover table-bordered table-condensed table-responsive">
<thead>
<tr>
<th>当前可用Token列表</th>
</tr>
</thead>
<tbody>
<?php
foreach ($tokenList as $value) {
echo '<tr><td>' . $value . '</td></tr>';
}
?>
</tbody>
</table>
</div>
<div class="col-md-4">
<form action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
<div class="form-group">
<label for="exampleInputInviteCode1" style="color:red">删除所选日期文件夹(删除之后无法恢复!):</label>
<input type="text" class="form-control form-date" name="delDir" value="<?php echo date('Y/m/d/'); ?>" readonly="">
</div>
<button type="submit" class="btn btn-mini btn-danger" onClick="return confirm('确认要删除?\n* 删除文件夹后将无法恢复!');">删除目录</button>
</form>
</div>
</div>
<div class="col-md-12">
<hr>
<div class="col-md-7">
<p>
<button type="button" class="btn" data-toggle="collapse" data-target="#lis_cache">疑似违规的图片<i class="icon icon-hand-down"></i></button>
</p>
<div class="collapse" id="lis_cache">
<p>为了访问速度仅显示最近20张图片监黄需要在<code>config.php</code>中开启<code>checkImg</code>属性。</p>
<p>key申请地址<a href="https://client.moderatecontent.com/" target="_blank">https://client.moderatecontent.com/</a></p>
<p>获得key后填入<code>/config/api_key.php</code>-><code>moderatecontent</code>属性</p>
<div class="table-responsive">
<table class="table table-hover table-bordered table-auto table-condensed table-striped">
<thead>
<tr>
<th>序号</th>
<th>缩略图</th>
<th>文件名</th>
<th>大小</th>
<th>查看图片</th>
<th>还原图片</th>
<th>删除图片</th>
</tr>
</thead>
<tbody>
<?php
// 获取被隔离的文件
@$cache_dir = APP_ROOT . $config['path'] . 'suspic/'; // cache目录
@$cache_file = getFile($cache_dir); // 获取所有文件
@$cache_num = count($cache_file); // 统计目录文件个数
for ($i = 0; $i < $cache_num and $i < 21; $i++) { // 循环输出文件
$file_cache_path = APP_ROOT . $config['path'] . 'suspic/' . $cache_file[$i]; // 图片绝对路径
$file_path = $config['path'] . 'suspic/' . $cache_file[$i]; // 图片相对路径
@$file_size = getDistUsed(filesize($file_cache_path)); // 图片大小
@$filen_name = $cache_file[$i]; // 图片名称
$url = $config['imgurl'] . $config['path'] . 'suspic/' . $cache_file[$i]; // 图片网络连接
$unlink_img = $config['domain'] . '/application/del.php?url=' . $url; // 图片删除连接
// 缩略图文件
$thumb_cache_file = $config['domain'] . '/application/thumb.php?img=' . $file_path . '&width=300&height=300';
echo '
<tr>
<td>' . $i . '</td>
<td><img data-toggle="lightbox" src="' . $thumb_cache_file . '" data-image="' . $thumb_cache_file . '" class="img-thumbnail" ></td>
<td>' . $filen_name . '</td>
<td>' . $file_size . '</td>
<td><a class="btn btn-mini" href="' . $url . '" target="_blank">查看原图</a></td>
<td><a class="btn btn-mini btn-success" href="?reimg=' . $filen_name . '">恢复图片</a></td>
<td><a class="btn btn-mini btn-danger" href="' . $unlink_img . '" target="_blank">删除图片</a></td>
</tr>
';
}
echo '
<span class="label label-primary label-outline">总数:' . $cache_num . '</span>&nbsp;
<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post">
<input type="hidden" name="delDir" value="/suspic/" readonly="">
<button class="btn btn-danger btn-mini" ">删除全部违规图片</button>
</form>
';
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-5">
<form class="form-inline" action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post">
<span class="label label-badge label-primary label-outline">已缓存文件:<?php echo getFileNumber(APP_ROOT . $config['path'] . 'thumb/'); ?>
占用<?php echo getDistUsed(getDirectorySize(APP_ROOT . $config['path'] . 'thumb/')); ?>
<button type="submit" class="btn btn-mini btn-primary" name="delDir" value="thumb/" onClick="return confirm('确认要清理缓存?\n* 删除文件夹后将无法恢复!');">清理</button></span>
</form>
</div>
</div>
</div>
</div>
<link href="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.css" rel="stylesheet">
<script src="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<script>
// 动态显示要删除的图片
var oBtn = document.getElementById('del');
var oTi = document.getElementById('title');
if ('oninput' in oBtn) {
oBtn.addEventListener("input", getWord, false);
} else {
oBtn.onpropertychange = getWord;
}
function getWord() {
var delimgurl = document.getElementById("delimgurl");
delimgurl.innerHTML += '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
// 仅选择日期
$(".form-date").datetimepicker({
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
minView: 2,
forceParse: 0,
format: "yyyy/mm/dd/"
});
// Title
document.title = "管理中心 - <?php echo $config['title']; ?>";
</script>
<?php require_once APP_ROOT . '/application/footer.php';

View File

@ -88,7 +88,7 @@ if ($handle->uploaded) {
header('Content-type:text/json');
// 上传成功后返回json数据
$imageUrl = $config['imgurl'] . config_path() . $handle->file_dst_name;
$delUrl = $config['domain'] . '/api/del.php?hash=' . urlHash(config_path() . $handle->file_dst_name, 0);
$delUrl = $config['domain'] . '/application/del.php?hash=' . urlHash(config_path() . $handle->file_dst_name, 0);
$reJson = array(
"result" => 'success',
@ -100,22 +100,22 @@ if ($handle->uploaded) {
} else {
// 上传错误 返回错误信息
$reJson = array(
"result" => 'failed',
"message" => $handle->error,
"result" => 'failed',
"message" => $handle->error,
"log" => $handle->log,
);
echo json_encode($reJson, JSON_UNESCAPED_UNICODE);
}
// 压缩图片 后压缩模式,不影响前台输出速度
if (!isAnimatedGif($handle->file_dst_pathname))
if ($config['compress']) {
require '../application/compress/Imagick/class.Imgcompress.php';
$img = new Imgcompress($handle->file_dst_pathname, 1);
$img->compressImg($handle->file_dst_pathname);
// 释放
ob_flush();
flush();
}
// 上传日志控制
if ($config['upload_logs']) {
require_once APP_ROOT . '/application/logs-write.php';
@write_log(config_path() . $handle->file_dst_name, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size, "API upload");
}
// 创建缩略图
if ($config['thumbnail']) {
@creat_thumbnail_images($handle->file_dst_name);
}
unset($handle);
}

View File

@ -50,11 +50,18 @@
// NProgress
NProgress.start();
NProgress.done();
// console
console.log("%cEasyImage 简单图床", "background: rgba(252,234,187,1);background: -moz-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%,rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 100%);background: -webkit-gradient(left top, right top, color-stop(0%, rgba(252,234,187,1)), color-stop(12%, rgba(175,250,77,1)), color-stop(28%, rgba(0,247,49,1)), color-stop(39%, rgba(0,210,247,1)), color-stop(51%, rgba(0,189,247,1)), color-stop(64%, rgba(133,108,217,1)), color-stop(78%, rgba(177,0,247,1)), color-stop(87%, rgba(247,0,189,1)), color-stop(100%, rgba(245,22,52,1)));background: -webkit-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 100%);background: -o-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 100%);background: -ms-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 100%);background: linear-gradient(to right, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fceabb', endColorstr='#f51634', GradientType=1 );font-size:2.34em;font-weight:bold")
console.log('%c图床演示网站 https://img.545141.com/ \n本程序由 Icret 独自开发并完全开源,碰到收费发布的请不要轻易付款;\n本人仅为程序开源创作如非法网站使用与本人无关请勿用于非法用途\n作为开发者你可以对相应的后台功能进行扩展增删改相应代码,但请保留代码中相关来源信息(例如:本人博客,邮箱等)。\n请为本人博客 https://www.545141.com/ 加上链接,谢谢尊重!%c ', 'color: #eaad1a; padding:5px 0; border:1px solid #448ef6; font-size:12px;', '');
/**
console.log("%c图床演示网站 https://img.545141.com/ \n本程序由 Icret 独自开发并完全开源,碰到收费发布的请不要轻易付款;\n本人仅为程序开源创作,如非法网站使用与本人无关,请勿用于非法用途; ", "color: #123456;font-size:14px;");
console.log("%c作为开发者你可以对相应的后台功能进行扩展增删改相应代码,但请保留代码中相关来源信息(例如:本人博客,邮箱等)\n请为本人博客 https://www.545141.com/ 加上链接,谢谢尊重!", "color: #eaad1a;font-size:14px;font-weight:bold;");
*/
</script>
<footer class="text-muted small col-md-12" style="text-align: center;margin-bottom: 10px"><?php if ($config['ad_bot']) {echo $config['ad_bot_info'];} ?>
<?php echo $config['customize']; ?>
<?php echo $config['customize']; ?>
<hr>
<!-- 对话框触发按钮 -->
<a href="#" data-position="center" data-moveable="inside" data-moveable="true" data-toggle="modal" data-target="#myModal">
<i class="icon icon-qrcode"></i>二维码 </a>
@ -68,17 +75,15 @@
if (isset($config['footer'])) {
echo '<div>' . $config['footer'] . '
Copyright © 2018-'.date('Y').'
Copyright © 2018-' . date('Y') . '
<a href="https://img.545141.com/" target="_blank"> EasyImage</a> By
<a href="https://www.545141.com" target="_blank"> Icret</a> Version:
<a href="https://github.com/icret/EasyImages2.0" target="_blank"> '. $config['version'].'</a>
<a href="https://github.com/icret/EasyImages2.0" target="_blank"> ' . $config['version'] . '</a>
<a href="/admin/terms.php" target="_blank"> DMCA</a>
</div>';
}
?>
</footer>
</body>

View File

@ -1,5 +1,5 @@
<?php
require_once __DIR__.'/../config/base.php';
require_once __DIR__ . '/../config/base.php';
require_once APP_ROOT . '/config/config.php';
// 判断GIF图片是否为动态
@ -304,7 +304,7 @@ function getActive($url)
$arr = $_SERVER['SCRIPT_NAME'];
if (strpos($arr, $url)) {
return 'active';
}else {
} else {
return '';
}
}
@ -406,10 +406,9 @@ function checkEnv($mode)
exit;
}
if($mode){
require_once __DIR__.'/check.php';
if ($mode) {
require_once __DIR__ . '/check.php';
}
}
@ -418,17 +417,29 @@ function imgRatio()
{
global $config;
if ($config['imgRatio']) {
$image_x = $config['image_x'];
$image_y = $config['image_y'];
echo '
if ($config['imgRatio_crop'] === 1) {
$imgRatio_crop = 'true';
} else {
$imgRatio_crop = 'false';
}
if ($config['imgRatio_preserve_headers'] === 1) {
$imgRatio_preserve_headers = 'true';
} else {
$imgRatio_preserve_headers = 'false';
}
return '
resize:{
width: ' . $image_x . ',
height: ' . $image_y . ',
preserve_headers: false, // 是否保留图片的元数据
},
';
width: ' . $config['image_x'] . ',
height: ' . $config['image_y'] . ',
crop: ' . $imgRatio_crop . ',
quality:' . $config['imgRatio_quality'] . ',
preserve_headers: ' . $imgRatio_preserve_headers . ',
}';
} else {
return null;
return 'resize:{}';
}
}
@ -490,7 +501,7 @@ function deldir($dir)
}
// curl访问网站并返回解码过的json信息
function get_json($img)
function moderatecontent_json($img)
{
global $config;
@ -517,7 +528,7 @@ function checkImg($imageUrl)
{
global $config;
$response = get_json($imageUrl);
$response = moderatecontent_json($imageUrl);
if ($response['rating_index'] == 3 or $response['predictions']['adult'] > $config['checkImg_value']) { // (1 = everyone, 2 = teen, 3 = adult)
//$old_path = APP_ROOT . parse_url($imageUrl)['path']; // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png
$old_path = APP_ROOT . str_replace($config['imgurl'], '', $imageUrl); // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png
@ -545,37 +556,37 @@ function re_checkImg($name)
rename($now_path_file, $to_file);
}
// 创建缩略图
function creat_cache_images($imgName)
function creat_thumbnail_images($imgName)
{
require_once __DIR__ . '/class.thumb.php';
global $config;
$old_img_path = APP_ROOT . config_path() . $imgName; // 获取要创建缩略图文件的绝对路径
$cache_path = APP_ROOT . $config['path'] . 'thumb/'; // cache目录的绝对路径
$cache_path = APP_ROOT . $config['path'] . 'thumbnails/'; // cache目录的绝对路径
if(!is_dir($cache_path)){ // 创建cache目录
mkdir($cache_path, 0777, true);
}
if (!is_dir($cache_path)) { // 创建cache目录
mkdir($cache_path, 0777, true);
}
if (!isAnimatedGif($old_img_path)) { // 仅针对非gif创建图片缩略图
$new_imgName = APP_ROOT . $config['path'] . 'thumb/' . date('Y_m_d') . '_' . $imgName; // 缩略图缓存的绝对路径
Thumb::out($old_img_path, $new_imgName, 300, 300); // 保存缩略图
$new_imgName = APP_ROOT . $config['path'] . 'thumbnails/' . date('Y_m_d') . '_' . $imgName; // 缩略图缓存的绝对路径
Thumb::out($old_img_path, $new_imgName, 300, 300); // 保存缩略图
}
}
// 根据请求网址路径返回缩略图网址
function back_cache_images($url)
function return_thumbnail_images($url)
{
global $config;
$cache_image_file = str_replace($config['imgurl'], '', $url);
if (isAnimatedGif(APP_ROOT . $cache_image_file)) { // 仅读取非gif的缩略图
if (isAnimatedGif(APP_ROOT . $cache_image_file)) { // 仅读取非gif的缩略图
return $url; // 如果是gif则直接返回url
} else {
$cache_image_file = str_replace($config['path'], '', $cache_image_file); // 将网址中的/i/去除
$cache_image_file = str_replace('/', '_', $cache_image_file); // 将文件的/转换为_
$isFile = APP_ROOT . $config['path'] . 'thumb/' . $cache_image_file; // 缓存文件的绝对路径
$cache_image_file = str_replace($config['path'], '', $cache_image_file); // 将网址中的/i/去除
$cache_image_file = str_replace('/', '_', $cache_image_file); // 将文件的/转换为_
$isFile = APP_ROOT . $config['path'] . 'thumbnails/' . $cache_image_file; // 缓存文件的绝对路径
if (file_exists($isFile)) { // 缓存文件是否存在
return $config['imgurl'] . $config['path'] . 'thumb/' . $cache_image_file; // 存在则返回缓存文件
return $config['imgurl'] . $config['path'] . 'thumbnails/' . $cache_image_file; // 存在则返回缓存文件
} else {
return $url; // 不存在直接返回url
}

View File

@ -59,17 +59,9 @@ require_once APP_ROOT . '/application/total_files.php';
</li>
<?php
if (is_online()) {
echo '
<li class="dropdown dropdown-hover">
<a class="dropdown-toggle" data-toggle="dropdown"><i class="icon icon-cogs"> 设置</i><span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="' . getActive('admin.inc') . '";><a href="' . $config['domain'] . '/admin/admin.inc.php' . '"><i class="icon icon-desktop"> 网站设置</i></a></li>
<li class="divider"></li>
<li class="' . getActive('tools') . '";><a href="' . $config['domain'] . '/admin/tools.php' . '"><i class="icon icon-rocket"> 快捷工具</i></a></li>
<li class="divider"></li>
<li class="' . getActive('counts') . '";><a href="' . $config['domain'] . '/admin/counts.php' . '"><i class="icon icon-pie-chart"> 上传统计</i></a></li>
</ul>
</li>
echo '
<li class="' . getActive('admin.inc') . '";><a href="' . $config['domain'] . '/admin/admin.inc.php' . '"><i class="icon icon-cogs"> 网站设置</i></a></li>
<li class="' . getActive('counts') . '";><a href="' . $config['domain'] . '/admin/counts.php' . '"><i class="icon icon-pie-chart"> 上传统计</i></a></li>
';
}
?>

View File

@ -22,7 +22,7 @@ if (!$config['showSwitch'] and !is_online()) {
echo '
<div class="col-md-4 col-sm-6 col-lg-3">
<div class="card">
<li><img data-image="' . back_cache_images($imgUrl) . '" src="../public/images/loading.svg" data-original="' . $imgUrl . '" alt="简单图床-EasyImage"></li>
<li><img data-image="' . return_thumbnail_images($imgUrl) . '" src="../public/images/loading.svg" data-original="' . $imgUrl . '" alt="简单图床-EasyImage"></li>
<div class="bottom">
<a href="' . $imgUrl . '" target="_blank"><i class="icon icon-picture" title="打开原图" style="margin-left:10px;"></i></a>
<a href="#" class="copy" data-clipboard-text="' . $imgUrl . '" title="复制文件" style="margin-left:10px;"><i class="icon icon-copy"></i></a>

View File

@ -1,85 +1,67 @@
<?php
require_once __DIR__ . '/function.php';
/**
* 获得用户的真实IP地址
* <br />来源ecshop
* <br />$_SERVER和getenv的区别getenv不支持IIS的isapi方式运行的php
* @access public
* @return string
*/
function real_ip()
{
static $realip = NULL;
if ($realip !== NULL) {
return $realip;
}
if (isset($_SERVER)) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
/* 取X-Forwarded-For中第一个非unknown的有效IP字符串 */
foreach ($arr as $ip) {
$ip = trim($ip);
if ($ip != 'unknown') {
$realip = $ip;
break;
}
}
} elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
$realip = $_SERVER['HTTP_CLIENT_IP'];
} else {
if (isset($_SERVER['REMOTE_ADDR'])) {
$realip = $_SERVER['REMOTE_ADDR'];
} else {
$realip = '0.0.0.0';
}
}
} else {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$realip = getenv('HTTP_X_FORWARDED_FOR');
} elseif (getenv('HTTP_CLIENT_IP')) {
$realip = getenv('HTTP_CLIENT_IP');
} else {
$realip = getenv('REMOTE_ADDR');
}
}
// 使用正则验证IP地址的有效性防止伪造IP地址进行SQL注入攻击
preg_match("/[\d\.]{7,15}/", $realip, $onlineip);
$realip = !empty($onlineip[0]) ? $onlineip[0] : '0.0.0.0';
return $realip;
}
require_once __DIR__ . '/real_ip.php';
/**
* 写日志
* 日志格式:图片名称->上传时间Asia/Shanghai->IP地址->浏览器信息->文件相对路径->图片的MD5
* 日志格式:图片名称->源文件名称->上传时间Asia/Shanghai->IP地址->浏览器信息->文件相对路径->图片的MD5
* $filePath 文件相对路径
* $sourceName 源文件名称
* $absolutePath 图片的绝对路径
* $fileSize 图片的大小
*/
function write_log($file, $imgMD5)
function write_log($filePath, $sourceName, $absolutePath, $fileSize, $from = "Web upload")
{
$name = trim(basename($file), " \t\n\r\0\x0B"); // 图片名称
global $config;
// 压缩图片 后压缩模式,不影响前台输出速度
if ($config['compress']) {
if (!isAnimatedGif($absolutePath)) {
require_once __DIR__ . '/compress/Imagick/class.Imgcompress.php';
$img = new Imgcompress($absolutePath, 1);
$img->compressImg($absolutePath);
// 释放
ob_flush();
flush();
}
}
// 图片违规检查
if ($config['checkImg']) {
require_once APP_ROOT . '/config/api_key.php';
@checkImg($config['imgurl'] . $filePath);
// 检查通过
$checkImg = "Images Passed";
} else {
// 未开通
$checkImg = "Check Closed";
}
$name = trim(basename($filePath), " \t\n\r\0\x0B"); // 当前图片名称
$log = array($name => array(
'date' => date('Y-m-d H:i:s'), // 上传日期
'ip' => real_ip(), // 上传ip
'user_agent' => $_SERVER['HTTP_USER_AGENT'], //浏览器信息
'path' => $file, // 文件相对路径
'md5' => $imgMD5, // 文件缓存相对位置
'source' => $sourceName, // 原始文件名称
'date' => date('Y-m-d H:i:s'), // 上传日期
'ip' => real_ip(), // 上传ip
'user_agent' => $_SERVER['HTTP_USER_AGENT'], // 浏览器信息
'path' => $filePath, // 文件相对路径
'size' => getDistUsed($fileSize), // 文件大小(格式化)
'md5' => md5_file($absolutePath), // 文件的md5
'checkImg' => $checkImg, // 图像审查
'from' => $from, // 图片上传来源
));
$logFileName = APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php';
// 创建日志文件夹
if(!is_dir(APP_ROOT.'/admin/logs/upload/')){
mkdir(APP_ROOT.'/admin/logs/upload',0755,true);
if (!is_dir(APP_ROOT . '/admin/logs/upload/')) {
mkdir(APP_ROOT . '/admin/logs/upload', 0755, true);
}
// 写入禁止浏览器直接访问
if (filesize($logFileName)==0){
$php_code = '<?php /** {图片名称{date:上传日期(Asia/Shanghai),ip:上传者IP,user_agent:上传者浏览器信息,path:图片相对路径,md5:图片的MD5}} */ exit;?>';
file_put_contents($logFileName, $php_code);
if (filesize($logFileName) == 0) {
$php_exit = '<?php /** {当前图片名称{source:源文件名称,date:上传日期(Asia/Shanghai),ip:上传者IP,user_agent:上传者浏览器信息,path:文件相对路径,size:文件大小(格式化),md5:文件MD5,checkImg:图像审查,form:图片上传来源}} */ exit;?>';
file_put_contents($logFileName, $php_exit);
}
$log = json_encode($log, true);
$log = json_encode($log, JSON_UNESCAPED_UNICODE);
file_put_contents($logFileName, PHP_EOL . $log, FILE_APPEND | LOCK_EX);
}
/*

51
application/real_ip.php Executable file
View File

@ -0,0 +1,51 @@
<?php
/**
* 获得用户的真实IP地址
* <br />来源ecshop
* <br />$_SERVER和getenv的区别getenv不支持IIS的isapi方式运行的php
* @access public
* @return string
*/
function real_ip()
{
static $realip = NULL;
if ($realip !== NULL) {
return $realip;
}
if (isset($_SERVER)) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
/* 取X-Forwarded-For中第一个非unknown的有效IP字符串 */
foreach ($arr as $ip) {
$ip = trim($ip);
if ($ip != 'unknown') {
$realip = $ip;
break;
}
}
} elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
$realip = $_SERVER['HTTP_CLIENT_IP'];
} else {
if (isset($_SERVER['REMOTE_ADDR'])) {
$realip = $_SERVER['REMOTE_ADDR'];
} else {
$realip = '0.0.0.0';
}
}
} else {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$realip = getenv('HTTP_X_FORWARDED_FOR');
} elseif (getenv('HTTP_CLIENT_IP')) {
$realip = getenv('HTTP_CLIENT_IP');
} else {
$realip = getenv('REMOTE_ADDR');
}
}
// 使用正则验证IP地址的有效性防止伪造IP地址进行SQL注入攻击
preg_match("/[\d\.]{7,15}/", $realip, $onlineip);
$realip = !empty($onlineip[0]) ? $onlineip[0] : '0.0.0.0';
return $realip;
}

View File

@ -23,14 +23,18 @@ $config=Array
'waterImg'=>'/public/images/watermark.png',
'extensions'=>'bmp,jpg,png,tif,gif,pcx,tga,svg,webp,jpeg,tga,svg,ico',
'compress'=>0,
'thumbnail'=>0,
'imgConvert'=>'',
'maxWidth'=>10240,
'maxHeight'=>10240,
'minWidth'=>5,
'minHeight'=>5,
'imgRatio'=>0,
'image_x'=>1000,
'image_x'=>800,
'image_y'=>800,
'imgRatio_quality'=>60,
'imgRatio_crop'=>1,
'imgRatio_preserve_headers'=>1,
'static_cdn'=>0,
'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0',
'ad_top'=>0,
@ -47,7 +51,7 @@ $config=Array
',
'showSwitch'=>1,
'listNumber'=>20,
'customize'=>' <!-- 统计代码-->
'customize'=>' <!-- 百度统计代码-->
<script>
var _hmt = _hmt || [];
(function() {
@ -56,30 +60,18 @@ $config=Array
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- 自定义js举例非img.545141.com跳转
<img style="display:none" src=" " onerror=\'this.onerror=null;var currentDomain="img."+"545141." + "com"; var str1=currentDomain; str2="docu"+"ment.loca"+"tion.host"; str3=eval(str2) ;if( str1!=str3 ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "currentDomain" + ")";eval(do_action) }\' />
-->
<!--自定义代码举例打赏、QQ邮箱、QQ群 可删除
<iframe src="https://img.545141.com/sponsor/index.html" style="overflow-x:hidden;overflow-y:hidden; border:0xp none #fff; min-height:240px; width:100%;" frameborder="0" scrolling="no"></iframe>
<a target="_blank" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=cR0UHB4fGBwxAABfEh4c">
<i class="icon icon-envelope-alt">联系邮箱 </i>
</a>
<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f">
<i class="icon icon-qq">加入QQ群</i>
</a>
<a target="_blank" href="/master.zip"><i class="icon icon-download-alt">下载源码</i></a>
--> ',
</script>',
'checkEnv'=>1,
'checkImg'=>0,
'checkImg_value'=>50,
'upload_logs'=>1,
'cache_freq'=>2,
'version'=>'2.4.3',
'version'=>'2.4.4',
'form'=>'',
'TinyImag_key'=>'',
'moderatecontent_key'=>'',
'footer'=>'<a href="/admin/terms.php" target="_blank">请勿上传违反中国政策的图片</a>
<i class="icon icon-smile"></i> <br/>'
'footer'=>'<a href="/admin/terms.php" target="_blank">请勿上传违反中国政策的图片</a>
<i class="icon icon-smile"></i> <br/>',
'imgRatio_save_headers'=>1,
'imgRatio_value'=>10
);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -84,50 +84,36 @@ if ($handle->uploaded) {
if ($ver >= '7.0') {
$delUrl = $config['domain'] . '/application/del.php?hash=' . urlHash(config_path() . $handle->file_dst_name, 0);
} else {
$delUrl = 'PHP≥7.0 才能启用删除';
$delUrl = 'PHP≥7.0 才能启用删除!';
}
// 创建缩略图
@creat_cache_images($handle->file_dst_name);
$reJson = array(
"result" => 'success',
"url" => $imageUrl,
"del" => $delUrl,
"url" => $imageUrl,
"del" => $delUrl,
);
echo json_encode($reJson);
$handle->clean();
} else {
// 上传错误 返回错误信息
$reJson = array(
"result" => 'failed',
"message" => $handle->error,
"result" => 'failed',
"message" => $handle->error,
"log" => $handle->log,
);
echo json_encode($reJson, JSON_UNESCAPED_UNICODE);
}
// 压缩图片 后压缩模式,不影响前台输出速度
if ($config['compress']) {
if (!isAnimatedGif($handle->file_dst_pathname)) {
require 'application/compress/Imagick/class.Imgcompress.php';
$img = new Imgcompress($handle->file_dst_pathname, 1);
$img->compressImg($handle->file_dst_pathname);
// 释放
ob_flush();
flush();
}
}
// 上传日志控制
if ($config['upload_logs'] == true) {
if ($config['upload_logs']) {
require_once APP_ROOT . '/application/logs-write.php';
@write_log(config_path() . $handle->file_dst_name,md5_file(APP_ROOT.config_path() . $handle->file_dst_name));
@write_log(config_path() . $handle->file_dst_name, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
}
// 创建缩略图
if ($config['thumbnail']) {
@creat_thumbnail_images($handle->file_dst_name);
}
unset($handle);
// 图片违规检查
if ($config['checkImg']) {
require_once APP_ROOT . '/config/api_key.php';
@checkImg($imageUrl);
}
}

View File

@ -105,7 +105,7 @@ mustLogin();
limitFilesCount: <?php echo $config['maxUploadFiles']; ?>,
// 自动上传失败的文件
autoResetFails: true,
<?php imgRatio(); ?>
<?php echo imgRatio(); ?>,
responseHandler : function(responseObject, file) {
var obj = JSON.parse(responseObject.response); //由JSON字符串转换为JSON对象
console.log(responseObject.response); // 输出log
@ -126,7 +126,7 @@ mustLogin();
var del = document.getElementById("del");
del.innerHTML += obj.del + "\n";
} else {
return '上传失败,服务器返回错误' + obj.message;
return '上传失败,服务器返回错误:' + obj.message;
}
}