pull/141/head
icret 2022-03-19 08:30:14 +00:00
parent a4c3fe3f89
commit c45098b364
12 changed files with 70 additions and 39 deletions

View File

@ -64,13 +64,13 @@ location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
}
```
## 安装
> 推荐环境Nginx + PHP≥7.0 + linux
#### windows:
- 下载简单图床 [最新版](https://github.com/icret/EasyImages2.0/archive/refs/heads/master.zip) | [稳定版](https://github.com/icret/EasyImages2.0/releases) 上传至web目录
- 下载简单图床 [最新版](https://github.com/icret/EasyImages2.0/archive/refs/heads/master.zip) | [稳定版](https://github.com/icret/EasyImages2.0/releases) 上传至web目录
#### Linux:
- `git clone https://github.com/icret/EasyImages2.0.git` 至web目录赋予www:www和0755权限
- `git clone https://github.com/icret/EasyImages2.0.git` 至web目录赋予www:www和0755权限
#### BT宝塔面板
- 安装环境 Ngixn(推荐) / Apache + PHP(推荐≥7.0)
@ -80,7 +80,7 @@ location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- 备份`config`目录(没有增加上传用户和api可以只保留`config.php`文件)和`上传文件目录`
- 将新程序下载至网站目录解压覆盖,然后将备份的文件替换既完成升级
- 如果出现错误请在设置中把所有底部设置点击一次`保存`
- 如果出现错误请在设置中把所有设置中底部按钮 `保存` 一次
## 安全配置
@ -116,8 +116,12 @@ $HTTP["url"] =~ "^/(i|public)/" {
<details><summary>点击查看2.0版更新日志</summary>
* 2022-3-15 v2.5.7 dev
- 修复图片回收批量删除失败
- 检测更改域名改为检测局域网
- 微调了广场样式
- 修复图片回收中批量删除失败
- 修复广场预览ico格式文件失败
- 日志将记录通过API上传者的ID
- 缩略图最大生成与用户设置关联
- 安全检测中检测本地域名改为检测局域网
* 2022-3-13 v2.5.6
- 修复加密删除后不能正确提示
@ -453,6 +457,8 @@ RewriteRule config/(.*).(php)$ [F]
![简单图床 - 广场界面](./install/README/3053540273.png)
![简单图床 - 后台界面](./install/README/2657944724.png)
![简单图床 - 统计界面](./install/README/1305032567.png)
![简单图床 - 图片信息](./install/README/info.png)
## 兼容
- 最低`PHP 5.6`,推荐`PHP≥7.0`及以上版本需要PHP支持`Fileinfo,iconv,zip,mbstring,openssl`扩展,如果缺失会导致无法上传/删除图片

View File

@ -370,7 +370,7 @@ if (isset($_GET['recycle_reimg'])) {
</div>
<div class="form-group">
<label>单文件最大上传(1-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">
<input type="range" class="form-control" name="maxSize" value="<?php echo $config['maxSize']; ?>" min="1048576" max="104857600" 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>px</label>
@ -380,7 +380,7 @@ if (isset($_GET['recycle_reimg'])) {
<label>最小上传高度 | 当前: </label><label id="minHeight"><?php echo $config['minHeight']; ?></label><label>px</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">
</div>
<h4 class="with-padding bg-success" style="text-align: center;">前端裁剪压缩 - 优点:服务器无压力 缺点:略增加用户端压力,仅支持JPG</h4>
<h4 class="with-padding bg-success" style="text-align: center;">前端裁剪压缩 - 优点:服务器无压力 缺点:PC配置低的会导致浏览器卡顿,偶现丢失方向信息,仅支持JPG</h4>
<div class="form-group">
<div class="switch switch-inline" data-toggle="tooltip" title="控制以下五项 不开启下边五项不生效">
<input type="hidden" name="imgRatio" value="0">

View File

@ -8,6 +8,7 @@ $token = preg_replace('/[\W]/', '', $_POST['token']); // 获取Token并过滤非
// 检查api合法性
check_api($token);
$tokenID = $tokenList[$token]['id'];
// 黑/白IP名单上传
if ($config['check_ip']) {
@ -27,7 +28,7 @@ if ($handle->uploaded) {
// 允许上传的mime类型
$handle->allowed = array('image/*');
// 文件命名
$handle->file_new_name_body = imgName($handle->file_src_name_body) . '_' . $tokenList[$token]['id'];
$handle->file_new_name_body = imgName($handle->file_src_name_body) . '_' . $tokenID;
// 最大上传限制
$handle->file_max_sizes = $config['maxSize'];
// 最大宽度
@ -98,19 +99,19 @@ if ($handle->uploaded) {
// 使用fastcgi_finish_request操作
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
// 普通模式鉴黄
// 鉴黄
@process_checkImg($imageUrl);
// 日志
if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size,$tokenID);
// 水印
@water($handle->file_dst_pathname);
// 压缩
@compress($handle->file_dst_pathname);
} else {
// 普通模式鉴黄
// 鉴黄
@process_checkImg($imageUrl);
// 日志
if ($config['upload_logs']) write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
if ($config['upload_logs']) write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size,$tokenID);
// 水印
@water($handle->file_dst_pathname);
// 压缩

View File

@ -91,7 +91,7 @@
width: 100%;
position: absolute;
bottom: -4px;
background-color: rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.2);
}
</style>
<div class="row" style="margin-bottom:100px">

View File

@ -77,13 +77,14 @@ function process_checkImg($imgurl)
/**
* 写日志
* 日志格式:图片名称->源文件名称->上传时间Asia/Shanghai->IP地址->浏览器信息->文件相对路径->图片的MD5
* {图片名称{source:源文件名称,date:上传日期(Asia/Shanghai),ip:上传者IP,user_agent:上传者浏览器信息,path:文件相对路径,size:文件大小(格式化),md5:文件MD5,checkImg:图像审查,form:上传方式web/API ID}}
* $filePath 文件相对路径
* $sourceName 源文件名称
* $absolutePath 图片的绝对路径
* $fileSize 图片的大小
* $form 来源如果是网页上传直接显示网页,如果是API上传则显示ID
*/
function write_log($filePath, $sourceName, $absolutePath, $fileSize, $from = "Web upload")
function write_log($filePath, $sourceName, $absolutePath, $fileSize, $from = "web")
{
global $config;
@ -111,7 +112,7 @@ function write_log($filePath, $sourceName, $absolutePath, $fileSize, $from = "We
// 写入禁止浏览器直接访问
if (filesize($logFileName) == 0) {
$php_exit = '<?php /** {当前图片名称{source:源文件名称,date:上传日期(Asia/Shanghai),ip:上传者IP,user_agent:上传者浏览器信息,path:文件相对路径,size:文件大小(格式化),md5:文件MD5,checkImg:图像审查,form:图片上传来源}} */ exit;?>';
$php_exit = '<?php /** {图片名称{source:源文件名称,date:上传日期(Asia/Shanghai),ip:上传者IP,user_agent:上传者浏览器信息,path:文件相对路径,size:文件大小(格式化),md5:文件MD5,checkImg:图像审查,form:上传方式web/API ID}} */ exit;?>';
file_put_contents($logFileName, $php_exit);
}

View File

@ -60,10 +60,10 @@ define('FILE_CACHE_DIRECTORY', APP_ROOT . $config['path'] . 'thumbnails');
define('NOT_FOUND_IMAGE', $config['imgurl'] . '/public/images/404.png');
define('ERROR_IMAGE', $config['imgurl'] . '/public/images/404.png');
define('DISPLAY_ERROR_MESSAGES', false);
define('MAX_FILE_SIZE', 10485760); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。
define('MAX_FILE_SIZE', $config['maxSize']); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。
define('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400); // 多久清理一次缓存
define('FILE_CACHE_MAX_FILE_AGE', 86400); // 文件必须从缓存中删除多长时间
define('BROWSER_CACHE_MAX_AGE', 864000); // 浏览器缓存时间
define('FILE_CACHE_MAX_FILE_AGE', 86400); // 文件必须从缓存中删除多长时间
define('BROWSER_CACHE_MAX_AGE', 864000); // 浏览器缓存时间
global $ALLOWED_SITES;
$ALLOWED_SITES = array(
@ -87,21 +87,46 @@ $ALLOWED_SITES = array(
* 修复无法生成生成webp动态图片的缩略图bug
*/
if (isset($_GET['img'])) {
// 获取图片后缀后4位
$ext = substr($_GET['img'], -4);
// 引入文件
require_once __DIR__ . '/TimThumb.php';
// 图片绝对路径
$src = APP_ROOT . $_GET['img'];
// 检测图片
if ($ext == 'webp' && isWebpAnimated($src)) {
// 输出动态的webp
header("Content-type: image/webp");
exit(file_get_contents($src, true));
// 获取文件后缀
$ext = pathinfo($src)['extension'];
// 404 文件
$i404 = APP_ROOT . '/public/images/404.png';
// 文件不存在
if (!is_file($src)) {
// 输出404
header("Content-type: image/png");
exit(file_get_contents($i404, true));
}
switch ($ext) {
case 'ico':
header("Content-type: image/jpeg");
exit(file_get_contents($src, true));
break;
case 'svg':
header('Content-Type:image/svg+xml');
exit(file_get_contents($src, true));
break;
case 'webp':
if (isWebpAnimated($src)) {
// 输出动态的webp
header("Content-type: image/webp");
exit(file_get_contents($src, true));
} else {
timthumb::start();
}
break;
default:
timthumb::start();
}
// 非动态webp输出
require_once __DIR__ . '/TimThumb.php';
timthumb::start();
} else {
// 输出404
header("Content-type: image/webp");
exit(file_get_contents(APP_ROOT . '/public/images/404.png', true));
header("Content-type: image/png");
exit(file_get_contents($i404, true));
}

View File

@ -2,7 +2,7 @@
$config=Array
(
'title'=>'简单图床 - EasyImage',
'keywords'=>'简单图床,easyimage,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制',
'keywords'=>'简单图床,easyimage,easyimage2.0,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制',
'description'=>'简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序,最新html5自适应页面兼容手机电脑,上传后返回图片直链,markdown图片,论坛贴图bbscode链接,简单方便支持一键复制,支持多域名,api上传',
'tips'=>'<a><li class="icon icon-bullhorn text-muted">单文件≤10M,单次上传≤30张</li></a>
<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-heart"> 简单图床是一款开源图床, 支持多文件上传无数据库</i></a>
@ -12,11 +12,11 @@ $config=Array
'user'=>'admin',
'password'=>'e6e061838856bf47e1de730719fb2609',
'mustLogin'=>0,
'apiStatus'=>0,
'apiStatus'=>1,
'path'=>'/i/',
'imgName'=>'default',
'maxSize'=>10485760,
'maxUploadFiles'=>100,
'maxUploadFiles'=>30,
'watermark'=>0,
'waterText'=>'简单图床 - png.cm',
'waterPosition'=>5,
@ -100,7 +100,7 @@ var _hmt = _hmt || [];
'delDir'=>'thumbnails/',
'hide'=>0,
'version'=>'2.5.6',
'update'=>'2022-03-16 01:57:25',
'update'=>'2022-03-19 14:44:36',
'terms'=>'<div class="container">
<div class="row">
<div class="col-xs-3">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

BIN
install/README/info.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -1,4 +1,2 @@
/**
* https://github.com/richardchen85/Marquee
*/
// https://github.com/richardchen85/Marquee
var Marquee=function(t){this.elem=null,this.step=0,this.stepInterval=400,this.interval=3e3,this.dir="left",this.autoPlay=!0,this.hoverPause=!0,this.pausing=!1,this.timerStep=null,this.timer=null,this.init(t)};Marquee.prototype={constructor:Marquee,init:function(t){return this.extend(t,this),this.elem?(this.elem.innerHTML+=this.elem.innerHTML,this.loadStyle(),this.hoverPause&&this.bindEvents(),this.autoPlay&&this.startScroll(),void 0):!1},loadStyle:function(){var t=this.elem.children;("left"==this.dir||"right"==this.dir)&&(this.elem.style.width=t[0].offsetWidth*t.length+"px"),"right"==this.dir&&0==this.elem.offsetLeft&&(this.elem.style.left=-this.elem.offsetWidth/2+"px"),"left"==this.dir&&this.elem.offsetLeft==-this.elem.offsetWidth/2&&(this.elem.style.left=0),"down"==this.dir&&0==this.elem.offsetTop&&(this.elem.style.top=-this.elem.offsetHeight/2+"px"),"up"==this.dir&&this.elem.offsetTop==-this.elem.offsetHeight/2&&(this.elem.style.top=0)},bindEvents:function(){var t=this;this.bind(this.elem.parentNode,"mouseover",function(){t.stop(),t.pausing=!0}),this.bind(this.elem.parentNode,"mouseout",function(){t.pausing=!1,t.autoPlay&&t.startScroll()})},stop:function(){clearInterval(this.timer)},doScroll:function(){var t,e,i,s,h,l=this;if("left"==this.dir||"right"==this.dir?(t="left",e="offsetLeft",h=this.elem.offsetWidth/2):(t="top",e="offsetTop",h=this.elem.offsetHeight/2),s="left"==this.dir||"up"==this.dir?-this.step:this.step,0==this.stepInterval)h-Math.abs(this.elem[e])<Math.abs(s)&&(s=s/Math.abs(s)*(h-Math.abs(this.elem[e]))),i=this.elem[e]+s,i=this.fixTarget(s,this.elem[e]+s,h),this.elem.style[t]=i+"px";else{if(null!=this.timerStep)return;this.stop();var n=30/l.stepInterval*s;n=0>n?Math.ceil(n):Math.floor(n),this.timerStep=setInterval(function(){n=n>0?Math.min(n,s):Math.max(n,s),i=l.fixTarget(n,l.elem[e]+n,h),l.elem.style[t]=i+"px",s-=n,0==s&&(clearInterval(l.timerStep),l.timerStep=null,l.autoPlay&&!l.pausing&&l.startScroll())},30)}},fixTarget:function(t,e,i){return 0>t&&Math.abs(e)>=i?0:t>0&&e>=0?-i:e},changeDir:function(t){this.dir=t,this.loadStyle(),this.doScroll()},startScroll:function(){var t=this;this.timer=setInterval(function(){t.doScroll()},t.interval)},extend:function(t,e){for(name in t)e[name]=t[name]},bind:function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=hanlder}};