From 54c4e6ff4a6352fd85ba9a0e7675e210b815de15 Mon Sep 17 00:00:00 2001 From: icret Date: Wed, 27 Oct 2021 21:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8A=E4=BC=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6--=E6=94=AF=E6=8C=81PHP8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api-web.php | 221 +++++++++++++++++++++++++++++++++++++++ api/apiTest/index.php | 38 +++++++ api/del.php | 81 ++++++++++++++ api/index.php | 121 +++++++++++++++++++++ api/libs/apiFunction.php | 52 +++++++++ favicon.ico | Bin 0 -> 4286 bytes robots.txt | 4 + 7 files changed, 517 insertions(+) create mode 100755 api/api-web.php create mode 100755 api/apiTest/index.php create mode 100755 api/del.php create mode 100755 api/index.php create mode 100755 api/libs/apiFunction.php create mode 100755 favicon.ico create mode 100755 robots.txt diff --git a/api/api-web.php b/api/api-web.php new file mode 100755 index 0000000..a2231d8 --- /dev/null +++ b/api/api-web.php @@ -0,0 +1,221 @@ + new $.zui.Messager("删除成功!", {type: "success" // 定义颜色主题 + }).show();'; + header("refresh:1;"); // 1s后刷新当前页面 + } else { + echo ' + '; + header("refresh:1;"); // 1s后刷新当前页面 + } +} +?> + +
+
+
+
+

EasyImage2.0 快捷操作中心

+
+
目录保存以 年/月/日/ 递进,非必要请勿修改!否则会导致部分操作不可用;
+
本人仅为程序开源创作,如非法网站使用与本人无关,请勿用于非法用途;
+
请为本人博客www.545141.com加上网址链接,谢谢支持。作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中相关来源信息(例如:本人博客,邮箱等)。
+

+ +

+
+
+
系统信息
+
+

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

+

WEB服务:

+

服务器IP:

+

系统时间:

+

已用空间:

+
PHP信息
+
+

PHP版本:

+

GD版本:

+

PHP上传限制:

+

POST上传限制:

+

PHP最长执行时间:

+

PHP允许占用内存:

+
我的信息
+
+

浏览器:

+

访问者IP:

+
图床信息
+
+

+

+

当前版本:,Github版本:

+ +
+
+
+
+
+
+
+ +
+ + New Token + + +
+
+
+ +
+
+ + +
+
+ +
+
+
+
+
+
+
+
+ + +
+ + +
+
+
+
+ +
+
+
+ + +
+
+ +
+
+ +
+
+ + +
+ +
+
+
+ + + + + + + + '; + } + ?> + +
当前可用Token列表:
' . $value . '
+
+
+
+
+ + +
+ + +
+
+
+ + + + + - EasyImage2.0'; +require_once '../../libs/function.php'; +require_once APP_ROOT . '/libs/header.php'; +require_once APP_ROOT . '/config/api_key.php'; + +// 如果关闭Api上传并且没有登录的情况下关闭测试接口 +if (!$config['apiStatus'] and !is_online()) { + exit(''); +} + +?> +
+
+
+

测试Token:

+
+
+ +
+
+ +
+ +
+
+ + + + + +
+ +
+
+ + +
+ +
+ + '; +if (empty($_REQUEST)) { + echo ' + + '; +} elseif (isset($_GET['url'])) { + $img = $_GET['url']; + echo ' +
+
+
图片属性:'.@getimagesize($img)[0].'px X '.@getimagesize($img)[1].'px
+ 简单图床-EasyImage +
'; +} + +// 解密删除 +if (isset($_GET['hash'])) { + $delHash = $_GET['hash']; + $delHash = urlHash($delHash, 1); + getDel($delHash, 'hash'); +} + +// 检查登录后再处理url删除请求 +if (is_online()) { + if (isset($_GET['url'])) { + getDel($_GET['url'], 'url'); + } +} else { + if (isset($_GET['url'])) { + echo ' + + '; + } +} + +require_once APP_ROOT . '/libs/footer.php'; +?> + \ No newline at end of file diff --git a/api/index.php b/api/index.php new file mode 100755 index 0000000..fecea54 --- /dev/null +++ b/api/index.php @@ -0,0 +1,121 @@ +uploaded) { + // 允许上传的mime类型 + $handle->allowed = array('image/*'); + // 文件命名 + $handle->file_new_name_body = imgName() . '_' . getID($token); + // 最大上传限制 + $handle->file_max_sizes = $config['maxSize']; + // 最大宽度 + $handle->image_max_width = $config['maxWidth']; + // 最大高度 + $handle->image_max_height = $config['maxHeight']; + // 最小宽度 + $handle->image_min_width = $config['minWidth']; + // 最小高度 + $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('../' . config_path()); + + // 设置水印 + if ($config['watermark'] > 0) { + switch ($config['watermark']) { + case 1: // 文字水印 过滤gif + if (isAnimatedGif($handle->file_src_pathname) === 0) { + $arr = [ + # 水印图片路径(如果不存在将会被当成是字符串水印) + 'res' => $config['waterText'], + # 水印显示位置 + 'pos' => $config['waterPosition'], + # 不指定name(会覆盖原图,也就是保存成thumb.jpeg) + 'name' => $handle->file_dst_pathname, + 'font' => $config['textFont'], + 'fontSize' => $config['textSize'], + 'color' => $config['textColor'], + ]; + Imgs::setWater($handle->file_dst_pathname, $arr); + } + break; + case 2: // 图片水印 + if (isAnimatedGif($handle->file_src_pathname) === 0) { + $arr = [ + # 水印图片路径(如果不存在将会被当成是字符串水印) + 'res' => $config['waterImg'], + # 水印显示位置 + 'pos' => $config['waterPosition'], + # 不指定name(会覆盖原图,也就是保存成thumb.jpeg) + 'name' => $handle->file_dst_pathname, + ]; + Imgs::setWater($handle->file_dst_pathname, $arr); + } + break; + default: + echo $handle->error; + break; + } + } + + // 图片完整相对路径:/i/2021/05/03/k88e7p.jpg + if ($handle->processed) { + 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); + + $reJson = array( + "result" => 'success', + "url" => $imageUrl, + "del" => $delUrl, + ); + echo json_encode($reJson); + $handle->clean(); + } else { + // 上传错误 返回错误信息 + $reJson = array( + "result" => 'failed', + "message" => $handle->error, + ); + echo json_encode($reJson, JSON_UNESCAPED_UNICODE); + } + + // 压缩图片 后压缩模式,不影响前台输出速度 + if (!isAnimatedGif($handle->file_dst_pathname)) + if ($config['compress']) { + require '../libs/compress/Imagick/class.Imgcompress.php'; + $img = new Imgcompress($handle->file_dst_pathname, 1); + $img->compressImg($handle->file_dst_pathname); + // 释放 + ob_flush(); + flush(); + } + + unset($handle); +} diff --git a/api/libs/apiFunction.php b/api/libs/apiFunction.php new file mode 100755 index 0000000..b367ef7 --- /dev/null +++ b/api/libs/apiFunction.php @@ -0,0 +1,52 @@ += 0) { + 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; + } + } +}; diff --git a/favicon.ico b/favicon.ico new file mode 100755 index 0000000000000000000000000000000000000000..023332362e2d1c649ce82d7baae01af98cef99b1 GIT binary patch literal 4286 zcmd5=X>3$g6h3e0-qJ!_kXEo%tWtJj5N)6fi=ZIEg{?pc+q7?5S{hs^P+A3oT1|f_ z&V1EAoiXHTGS_`DN9R{-dZge*u$BEEcZEGFC_gMs6tMk)UTvY`z`?zXgrXWIX7 z=DK5Jx9N{B*e)Lve)cX?u zAgz&?jlRdrMp>zeuX(9Kt3I%We>AR&ZF3yeY7T8C9?CYglt&$!EQ`RbvK?CfsTbrGpX>ep_c zH(JCZJnc3S@~Ca75qy)0k8>o?B4^H%E$T!&+1Xt}Up1r=F{jbG(bTXw{mmZVv*Q~K zY^k3x{E&&ipZq6$Kl0`{+3;0>UFl6lJ3a*AO)^j_qXS)j9hJW=t!Pia{d`p($!=|}{?O!Rh-_HuZdA=OeP^KOD zg}NG=%hyj~+O1#w#Lcixpu?A%_V7d~Fc)Ue*7{Nb6IhIgz`tjBeZc-w>QuteOK zlX-S<5ijn0N9L7$wd!kcpLEn75qe3#E6w)61k-o(EXK3IHY8(=5;^oWz&jo2SwV67 zvM0}L)%)5OUw`({x;wQ)@WqKg-?fK#q5G4GZE0;VWU^8_Cpt(kh~3E!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