diff --git a/README.md b/README.md index 0dad5ee..526cdd7 100755 --- a/README.md +++ b/README.md @@ -71,12 +71,37 @@ location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ #### Linux: -- `git clone https://github.com/icret/EasyImages2.0.git` 至web根目录赋予www:www和0755权限 +- `git clone https://github.com/icret/EasyImages2.0.git` 至web目录 + +- 赋予web目录www:www和0755权限: +```shell +chmod 755 -R /web目录 +chown -R www:www /web目录 +``` #### BT宝塔面板 - 安装环境 Ngixn(推荐) / Apache + PHP(推荐≥7.0) - 软件商店搜索`简单图床`一键部署 +#### API使用 +- 示例 +```html +
+ + +
+``` +- 上传成功后返回JSON +```json +{ + "result": "success", + "code": 200, + "url": "http://127.0.0.1/i/2022/05/03/vfyjtq-0.png", + "srcName": "2532516028", + "thumb": "http://127.0.0.1/application/thumb.php?img=/i/2022/05/03/vfyjtq-0.png", + "del": "http://127.0.0.1/application/del.php?hash=ZnVzYlZEM0dJUWhiQ2UzVVVsK1haMG5nNk92K0d3Q3JldjMyWlF5bHFxcz0=" +} +``` ## 程序升级 - 备份`config`目录(没有增加上传用户和api可以只保留`config.php`文件)和`上传文件目录` @@ -149,12 +174,13 @@ $HTTP["url"] =~ "^/(i|public)/" {
点击查看2.0版更新日志 -* 2022-04-30 v2.6.1 +* 2022-05-03 v2.6.1 - 增加登陆用户有效期 - 增加管理员/登陆用户/Token专用目录 - 增加转换图片格式后压缩图片(不建议同时开启后端压缩) - 增加隐藏存储路径(网站域名与图片域名不同且图片域名需绑定到图片目录) - 直链缩略图支持bmp,webp +- 本次更新较大,建议重新安装! * 2022-04-29 v2.6.0 - 修复源图缺陷 diff --git a/admin/admin.inc.php b/admin/admin.inc.php index b7d9b30..ba779ca 100755 --- a/admin/admin.inc.php +++ b/admin/admin.inc.php @@ -535,7 +535,7 @@ if (isset($_GET['recycle_reimg'])) {
-
+
> @@ -558,21 +558,21 @@ if (isset($_GET['recycle_reimg'])) {
-
+
>
-
+
>
-
+
> @@ -657,7 +657,6 @@ if (isset($_GET['recycle_reimg'])) {

key申请地址: https://client.moderatecontent.com/

获得key后打开->API 设置->Moderate Key->填入key

为了访问速度,仅显示最近20张图片;鉴黄需要在图床安全->图片鉴黄中开启

-

无法恢复 用户分离 Token分离 管理分离 的图片

@@ -705,7 +704,8 @@ if (isset($_GET['recycle_reimg'])) {
-
系统信息
+
系统信息
+

服务系统: ' . php_uname() . ''; ?>

Web服务:

服务器IP:

@@ -713,7 +713,8 @@ if (isset($_GET['recycle_reimg'])) {

占用内存:

占用磁盘:

剩余磁盘:

-
PHP信息
+
PHP信息
+

PHP Version:

PHP Model:

PHP Max UP:

@@ -721,10 +722,12 @@ if (isset($_GET['recycle_reimg'])) {

PHP Max Memery:

POST Max Upload:

GD:

-
我的信息
-

Your IP:

+
我的信息
+
+

IP:

Browser:

-
图床信息
+
图床信息
+
API 插件
Edge Chrome @@ -906,7 +909,7 @@ if (isset($_GET['recycle_reimg'])) {
- * 开启用户分离后删除上传按钮激活, 删除后不可恢复'; ?> +
* 开启用户分离后删除上传按钮激活, 删除后不可恢复
@@ -952,7 +955,6 @@ if (isset($_GET['recycle_reimg'])) {
图片回收 用户自行删除的会显示在这个页面

为了访问速度,仅显示最近20张图片; 图片回收需要在图床安全->图片回收中开启

-

无法恢复 用户分离 Token分离 管理分离 的图片

diff --git a/api/index.php b/api/index.php index fa653c8..d208fe8 100755 --- a/api/index.php +++ b/api/index.php @@ -93,8 +93,12 @@ if ($handle->uploaded) { if ($handle->processed) { header('Content-type:text/json'); // 上传成功后返回json数据 - $pathIMG = $Img_path . $handle->file_dst_name; + // 图片相对路径 + $pathIMG = $Img_path . $handle->file_dst_name; + // 图片访问网址 $imageUrl = rand_imgurl() . $pathIMG; + // 后续处理地址 + $processUrl = $config['domain'] . $pathIMG; // 原图保护 key值是由crc32加密的hide_key // $hide_original = $config['hide'] == 1 ? $config['domain'] . '/application/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['hide_key'])) : $imageUrl; @@ -154,7 +158,7 @@ if ($handle->uploaded) { if (function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); // 鉴黄 - @process_checkImg($imageUrl); + @process_checkImg($processUrl); // 日志 if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size, $tokenID); // 水印 @@ -163,7 +167,7 @@ if ($handle->uploaded) { @compress($handle->file_dst_pathname); } else { // 鉴黄 - @process_checkImg($imageUrl); + @process_checkImg($processUrl); // 日志 if ($config['upload_logs']) write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size, $tokenID); // 水印 diff --git a/application/function.php b/application/function.php index 4222ac3..9ec075b 100755 --- a/application/function.php +++ b/application/function.php @@ -861,14 +861,14 @@ function checkImg($imageUrl, $type = 1, $dir = 'suspic/') /** # 如果违规则移动图片到违规文件夹 */ if ($bad_pic == true) { - // $old_path = APP_ROOT . str_replace($config['domain'], '', $imageUrl); // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png - $old_path = APP_ROOT . parse_url($imageUrl)['path']; // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png + $old_path = APP_ROOT . parse_url($imageUrl)['path']; // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png + $name = parse_url($imageUrl)['path']; // 获得图片的相对地址 + $name = str_replace($config['path'], '', $name); // 去除 path目录 + $name = str_replace('/', '_', $name); // 文件名 2021_10_30_p8vypd.png + $new_path = APP_ROOT . $config['path'] . $dir . $name; // 新路径含文件名 + $suspic_dir = APP_ROOT . $config['path'] . $dir; // suspic路径 - $name = date('Y_m_d') . '_' . basename($imageUrl); // 文件名 2021_10_30_p8vypd.png - $new_path = APP_ROOT . $config['path'] . $dir . $name; // 新路径含文件名 - $suspic_dir = APP_ROOT . $config['path'] . $dir; // suspic路径 - - if (!is_dir($suspic_dir)) { // 创建suspic目录并移动 + if (!is_dir($suspic_dir)) { // 创建suspic目录并移动 mkdir($suspic_dir, 0777, true); } if (is_file($old_path)) { diff --git a/config/config.php b/config/config.php index 92d534f..ba07e09 100755 --- a/config/config.php +++ b/config/config.php @@ -11,11 +11,11 @@ $config=Array 'notice'=>'

简单图床是一款开源图床, 支持多文件上传无数据库;

如果你喜欢这种图床风格就下载喔 (๑•̀ㅂ•́)و✧

', 'domain'=>'http://127.0.0.1', - 'imgurl'=>'http://127.0.0.1', + 'imgurl'=>'http://127.0.0.1,http://192.168.2.100', 'user'=>'admin', 'password'=>'e6e061838856bf47e1de730719fb2609', 'mustLogin'=>0, - 'apiStatus'=>0, + 'apiStatus'=>1, 'path'=>'/i/', 'mime'=>'image/*,video/*', 'imgName'=>'default', @@ -92,7 +92,7 @@ $config=Array 'token_path_status'=>0, 'admin_path'=>'u', 'version'=>'2.6.1', - 'update'=>'2022-05-03 00:57:40', + 'update'=>'2022-05-03 19:00:49', 'footer'=>'请勿上传违反中国政策的图片