diff --git a/README.md b/README.md index b3bbd3a..87699d3 100644 --- a/README.md +++ b/README.md @@ -28,15 +28,18 @@ #### 注意: 1. 安装之前先使用浏览器访问check.php检查扩展是否都安装! -2. 请将所有文件赋予0755权限或www权限 -3. 上传后必须修改config.php的位置: +2. 使用前请注意先修改config.php中的domain域名。 +3. 请将所有文件必须赋予0755权限,或者赋予www权限 +4. 上传后必须修改config.php的位置: - domain 当前图片域名 - password 登录管理密码! -4. 如果无法登陆管理界面或上传图片,请先打开check.php检查扩展或者使用phpinfo检查。 -5. 可以使用浏览器的 F12调试模式->console查看错误 -6. 如果对php不太熟悉的话,不要将图床程序放置于二级目录 -7. 下载源码后可以删除一些文件:README.md,check.php,LICENSE -8. 欢迎加群:[623688684](https://shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f) +5. 如果无法登陆管理界面或上传图片,请先打开check.php检查扩展或者使用phpinfo检查。 +6. 可以使用浏览器的 F12调试模式->console查看错误 +7. 如果对php不太熟悉的话,不要将图床程序放置于二级目录 +8. js不要设置分片上传大小,此会导致部分图片上传失败。 +9. 默认我会给你设置成最优方案,api上传默认关闭 +10. 下载源码后可以删除一些文件:README.md,check.php,LICENSE +11. 欢迎加群:[623688684](https://shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f) #### API上传示例: 参数: @@ -57,7 +60,7 @@ html form上传示例: api上传成功后返回json: ```json -// 参数:"sucess"上传成功 "url" 图片链接 "del" 删除链接 "failed" 上传失败 "message" 错误信息 +参数:"sucess"上传成功 "failed" 上传失败 "url" 图片链接 "del" 删除链接 {"result":"success","url":"http:\/\/192.168.1.15\/i\/2021\/05\/03\/u34au6_2.jpg","del":"http:\/\/192.168.1.15\/api\/api-web.php?hash=XH%BB2Z%D1%08%D8%E2%D7%048%DFJ%86n%C0%06%DAD%DCP%3E%CF%C4%1B%60%E5%C4Pli"} ``` @@ -83,15 +86,6 @@ RewriteRule config/(.*).(php)$ – [F]
点击查看2.0版更新日志 -* 2021-5-8 v2.1.1 -- 修复上传界面上传失败提示信息bug -- 浏览页面重构 -- 删除页面添加登录删除 -- 调整首页显示 -- 将调整图片长宽放置前端,减小资源开销 -- 其他小调整 - - * 2021-5-2 v2.1 - 将tinyfilemanager配置文件简单翻译并集成到config.php - 增加底部自定义信息 diff --git a/api/api-web.php b/api/api-web.php index 797d61e..8613b07 100644 --- a/api/api-web.php +++ b/api/api-web.php @@ -8,18 +8,12 @@ require_once '../libs/function.php'; /*//////////////////////////////////////////////////////////*/ -// 根据token查找用户ID +// 查找token if (isset($_POST['token'])) { - $getID = '用户ID:' . getID($_POST['token']); + $getID = '用户ID:' . getID($_POST['token']); } else { $getID = null; } -// 根据用户ID查找token -if (isset($_POST['id'])) { - $getToken = '用户token:' . getIDToken($_POST['id']); -} else { - $getToken = null; -} // 提交登录 if (isset($_POST['password'])) { @@ -83,20 +77,6 @@ if (!is_online()) { 查找 - -
-
-
-
- - -
- -
@@ -107,6 +87,7 @@ if (!is_online()) {
+ @@ -159,23 +140,4 @@ if (!is_online()) { } */ -
- - - - - - - - '; - } - } - ?> - -
当前Token列表:
' . $value . '
-
- -
- -
-
- - -
- -
- - '; if (empty($_REQUEST)) { echo ' '; } elseif (isset($_GET['url'])) { + //$img = isset($_GET['hash'])?:$_GET['url']; $img = $_GET['url']; - echo ' -
-
- 简单图床-EasyImage -
'; + //echo '简单图床-EasyImage'; + echo '简单图床-EasyImage'; } // 解密删除 @@ -61,26 +47,3 @@ if (is_online()) { } require_once '../libs/footer.php'; -?> - \ No newline at end of file diff --git a/api/libs/apiFunction.php b/api/libs/apiFunction.php index 3b79e02..434d545 100644 --- a/api/libs/apiFunction.php +++ b/api/libs/apiFunction.php @@ -32,21 +32,9 @@ function getID($token) global $tokenList; $token = preg_replace('/[\W]/', '', $token); // 过滤非字母数字,删除空格 $key = array_search($token, $tokenList); - if ($key >= 0) { + if ($key) { return $key; } else { return ('没有这个用户ID'); } -}; - -// 通过ID查找用户Token -function getIDToken($id) -{ - global $tokenList; - $id = preg_replace('/[\W]/', '', $id); // 过滤非字母数字,删除空格 - foreach ($tokenList as $key => $value) { - if ($key == $id) { - return $value; - } - } -}; +}; \ No newline at end of file diff --git a/config/config.php b/config/config.php index 5051e07..759cfd7 100644 --- a/config/config.php +++ b/config/config.php @@ -60,7 +60,7 @@ $config = array( // 登录上传和后台管理密码,管理用户名为:admin 'password' => 'admin@123', // 是否开启API上传 开启:true 关闭:false - 'apiStatus' => false, + 'apiStatus' => true, // 是否开启水印:0关闭,1文字水印,2图片水印 不能使用动态gif添加水印 'watermark' => 0, // 水印文字内容 @@ -81,7 +81,7 @@ $config = array( // 图片水印路径 支持GIF,JPG,BMP,PNG和PNG alpha 'waterImg' => 'public/images/watermark.png', // 允许上传的图片扩展名 - 'extensions' => ['bmp', 'jpg', 'png', 'tif', 'gif', 'pcx', 'tga', 'svg', 'webp', 'jpeg', 'tga', 'svg', 'ico'], + 'extensions' => array('bmp', 'jpg', 'png', 'tif', 'gif', 'pcx', 'tga', 'svg', 'webp', 'jpeg', 'tga', 'svg', 'ico'), // 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:'' 'imgConvert' => '', // 最大上传宽度 @@ -92,12 +92,12 @@ $config = array( 'minWidth' => 5, // 允许上传的最小高度 'minHeight' => 5, - // 改变图片宽高 宽度和高度请设置 image_x image_y 开启:true 关闭:false 关闭下image_x和image_y设置不生效 + // 等比例缩小图片 宽度和高度请设置 image_x image_y 开启:true 关闭:false 关闭下image_x和image_y设置不生效 'imgRatio' => false, // 缩减的最大高度 - 'image_x' => 1000, + 'image_x' => 10240, // 缩减的最大宽度 - 'image_y' => 800, + 'image_y' => 10240, // 开启静态文件CDN 开启:true 关闭:false 'static_cdn' => false, // 开启顶部广告 开启:true 关闭:false 如果想添加或修改广告请到 public/static/ad_top.html @@ -108,7 +108,7 @@ $config = array( 'showSwitch' => true, // 默认预览数量,可在网址后填写参数实时更改预览数量 如:https://img.545141.com/libs/list.php?num=3 'listNumber' => 20, - // 上传框底部自定义信息,仅支持html格式 下面是举例: + // 上传框底部自定义信息,仅支持html格式 'customize' => ' + --> ', // 扩展与基本设置检测 开启:true 关闭:false 'checkEnv' => true, // 当前版本 - 'version' => '2.1.1', + 'version' => '2.1.0', ); diff --git a/file.php b/file.php index 89b0997..2fd3826 100644 --- a/file.php +++ b/file.php @@ -12,7 +12,7 @@ if ($handle->uploaded) { // 文件命名 $handle->file_new_name_body = imgName(); // 最大上传限制 - //$handle->file_max_sizes = $config['maxSize']; + $handle->file_max_sizes = $config['maxSize']; // 最大宽度 $handle->image_max_width = $config['maxWidth']; // 最大高度 @@ -23,15 +23,13 @@ if ($handle->uploaded) { $handle->image_min_height = $config['minHeight']; // 转换图片为指定格式 $handle->image_convert = $config['imgConvert']; - - /* 等比例缩减图片 + + //等比例缩减图片 if ($config['imgRatio']) { $handle->image_resize = true; $handle->image_x = $config['image_x']; $handle->image_y = $config['image_y']; } - */ - // 存储图片路径:images/201807/ $handle->process(__DIR__ . config_path()); @@ -75,6 +73,8 @@ if ($handle->uploaded) { // 图片完整相对路径:/i/2021/05/03/k88e7p.jpg if ($handle->processed) { header('Content-type:text/json'); + + // 上传成功后返回json数据 $imageUrl = $config['domain'] . config_path() . $handle->file_dst_name; $delUrl = $config['domain'] . '/api/del.php?hash=' . urlHash(config_path() . $handle->file_dst_name, 0); diff --git a/index.php b/index.php index 2e5ea27..c505033 100644 --- a/index.php +++ b/index.php @@ -82,13 +82,13 @@ mustLogin(); diff --git a/libs/footer.php b/libs/footer.php index 5c6edc7..b619604 100644 --- a/libs/footer.php +++ b/libs/footer.php @@ -48,8 +48,8 @@ makeCode(); } }); - - // NProgress + +