diff --git a/README.md b/README.md index ca2fa8e..93d4aa0 100755 --- a/README.md +++ b/README.md @@ -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)/" {
点击查看2.0版更新日志 * 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`扩展,如果缺失会导致无法上传/删除图片 diff --git a/admin/admin.inc.php b/admin/admin.inc.php index fe24069..d337757 100755 --- a/admin/admin.inc.php +++ b/admin/admin.inc.php @@ -370,7 +370,7 @@ if (isset($_GET['recycle_reimg'])) {
- +
@@ -380,7 +380,7 @@ if (isset($_GET['recycle_reimg'])) {
-

前端裁剪压缩 - 优点:服务器无压力 缺点:略增加用户端压力,仅支持JPG

+

前端裁剪压缩 - 优点:服务器无压力 缺点:PC配置低的会导致浏览器卡顿,偶现丢失方向信息,仅支持JPG

diff --git a/api/index.php b/api/index.php index 3574f40..7e589e2 100755 --- a/api/index.php +++ b/api/index.php @@ -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); // 压缩 diff --git a/application/list.php b/application/list.php index 6cdb459..a692586 100755 --- a/application/list.php +++ b/application/list.php @@ -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); }
diff --git a/application/process.php b/application/process.php index dc3861d..cce7ba3 100755 --- a/application/process.php +++ b/application/process.php @@ -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_exit = ''; file_put_contents($logFileName, $php_exit); } diff --git a/application/thumb.php b/application/thumb.php index 47fe606..45114a2 100755 --- a/application/thumb.php +++ b/application/thumb.php @@ -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)); } diff --git a/config/config.php b/config/config.php index 48e68ee..a678246 100755 --- a/config/config.php +++ b/config/config.php @@ -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'=>'
  • 单文件≤10M,单次上传≤30张
  • 简单图床是一款开源图床, 支持多文件上传无数据库 @@ -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'=>'
    diff --git a/install/README/2657944724.png b/install/README/2657944724.png index 6a0a8da..91be98c 100755 Binary files a/install/README/2657944724.png and b/install/README/2657944724.png differ diff --git a/install/README/3053540273.png b/install/README/3053540273.png index 2c4d01c..82b1fc2 100755 Binary files a/install/README/3053540273.png and b/install/README/3053540273.png differ diff --git a/install/README/674074848.png b/install/README/674074848.png index 165377f..0e8e723 100755 Binary files a/install/README/674074848.png and b/install/README/674074848.png differ diff --git a/install/README/info.png b/install/README/info.png new file mode 100755 index 0000000..cd33954 Binary files /dev/null and b/install/README/info.png differ diff --git a/public/static/marquee/marquee.min.js b/public/static/marquee/marquee.min.js index 709600f..a61ed12 100755 --- a/public/static/marquee/marquee.min.js +++ b/public/static/marquee/marquee.min.js @@ -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])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}}; \ No newline at end of file