parent
d2ce0a2470
commit
699b4451ce
49
README.md
49
README.md
|
@ -22,7 +22,7 @@
|
|||
>本人善写bug 发现bug可提交 [issues](https://github.com/icret/EasyImages2.0/issues) 追求稳定请下载 [稳定版](https://github.com/icret/EasyImages2.0/releases)
|
||||
|
||||
## 目录
|
||||
[特点](#特点) [使用注意](#使用注意) [安装](#安装) [程序升级](#程序升级) [安全配置](#安全配置) [更新日志](#更新日志) [支持开发者](#支持开发者) [界面演示](#界面演示) [兼容](#兼容) [鸣谢](#鸣谢) [开源许可](#开源许可)
|
||||
[特点](#特点) [注意](#常见问题) [安装](#安装) [升级](#程序升级) [安全](#安全配置) [更新日志](#更新日志) [支持开发者](#支持开发者) [界面演示](#界面演示) [兼容](#兼容) [鸣谢](#鸣谢) [开源许可](#开源许可)
|
||||
|
||||
## 特点
|
||||
|
||||
|
@ -42,21 +42,31 @@
|
|||
- [x] 支持创建仅上传用户
|
||||
- [x] 更多支持请安装尝试···
|
||||
|
||||
## 使用注意
|
||||
## 常见问题
|
||||
|
||||
1. 请将所有文件赋予`0755`和`www`权限
|
||||
2. 对`PHP`不太熟悉的请不要将图床程序放置于二级目录
|
||||
3. 请关闭防跨站或删除域名文件夹内的`user.ini`文件 如宝塔面板
|
||||
3. 请关闭防跨站或删除域名文件夹内的`user.ini`文件 如`宝塔面板`|`军哥lnmp`
|
||||
4. 网站域名与图片域名必须填写,如果只有一个域名请填写成一样的
|
||||
5. 第一次使用会执行安装程序并生成`install.lock` 不执行安装可以删除`install`目录
|
||||
6. 第一次访问会检查环境并在`config`目录下生成`EasyImage.lock`
|
||||
5. 首次使用会执行安装程序并生成`install.lock` 跳过安装流程请删除`install`目录
|
||||
6. 首次访问首页会检查环境并在`config`目录下生成`EasyImage.lock`
|
||||
7. 可以使用谷歌浏览器的调试模式查看错误`F12->console`
|
||||
8. 出现`undefined function imagecreatefromwebp()`是因为GD没安装webp
|
||||
9. 出现`upload File size exceeds the maximum value` 调整`PHP`上传大小
|
||||
10. 出现`Warning: is_dir(): open_basedir restriction in effect`解决方法同`3`
|
||||
11. 出现`Fatal error: Allowed memory size......`主机内存或分配给PHP的内存不够 解决方法百度
|
||||
12. 不出验证码: 权限问题见问题1 CDN缓存了/开防火墙了
|
||||
8. 不显示验证码: 1. 权限问题见问题`1` 2. CDN缓存了 3. 开防火墙了
|
||||
9. `upload File size exceeds the maximum value` 调整`PHP`上传大小
|
||||
10. `undefined function imagecreatefromwebp()`GD没安装webp, 以此类推
|
||||
11. `Warning: is_dir(): open_basedir restriction in effect`解决方法同`3`
|
||||
12. 出现`Fatal error: Allowed memory size......`主机内存或分配给PHP的内存不够 解决方法百度
|
||||
13. 如果开启原图保护功后打开图片链接显示`404`是因为`nginx`或`Apache`页面缓存导致的,`Nginx`解决办法:
|
||||
|
||||
```Nginx
|
||||
# 把Nginx这段配置删掉
|
||||
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
|
||||
{
|
||||
expires 30d;
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
```
|
||||
## 安装
|
||||
|
||||
- windows:
|
||||
|
@ -68,8 +78,10 @@
|
|||
|
||||
## 程序升级
|
||||
|
||||
- 备份`config`目录(没有增加上传用户和api可以只保留`config.php`文件)和`图片目录`
|
||||
- 备份`config`目录(没有增加上传用户和api可以只保留`config.php`文件)和`上传文件目录`
|
||||
- 将新程序下载至网站目录解压覆盖,然后将备份的文件替换既完成升级
|
||||
- 如果出现错误请在设置中把所有底部设置点击一次`保存`
|
||||
-
|
||||
|
||||
## 安全配置
|
||||
|
||||
|
@ -104,10 +116,13 @@ $HTTP["url"] =~ "^/(i|public)/" {
|
|||
|
||||
<details><summary>点击查看2.0版更新日志</summary>
|
||||
|
||||
* 2022-3-10 v2.5.6 dev
|
||||
* 2022-3-13 v2.5.6 dev
|
||||
- 修复加密删除后不能正确提示
|
||||
- 修复webp转换其他格式失败
|
||||
- 修复文字水印透明度不生效
|
||||
- 修复jscolor显示不正确
|
||||
- 增加原图保护
|
||||
- 增加检测版本
|
||||
|
||||
* 2022-3-4 v2.5.5
|
||||
- 增加设置页面检测是否开启登录上传
|
||||
|
@ -427,14 +442,14 @@ RewriteRule config/(.*).(php)$ – [F]
|
|||
## 支持开发者
|
||||
|支付宝支持|微信支持|
|
||||
|:----:|:----:|
|
||||
|![支付宝支持](https://png.cm/sponsor/images/alipay.jpg)|![微信支持](https://png.cm/sponsor/images/wechat.jpg)|
|
||||
|![支付宝支持](./public/images/alipay.jpg)|![微信支持](./public/images/wechat.jpg)|
|
||||
|
||||
## 界面演示
|
||||
|
||||
![简单图床 - 上传界面](https://blog.png.cm/usr/uploads/2022/02/674074848.png)
|
||||
![简单图床 - 广场界面](https://blog.png.cm/usr/uploads/2022/02/3053540273.png)
|
||||
![简单图床 - 后台界面](https://blog.png.cm/usr/uploads/2022/02/2657944724.png)
|
||||
![简单图床 - 统计界面](https://blog.png.cm/usr/uploads/2022/02/1305032567.png)
|
||||
![简单图床 - 上传界面](./install/README/674074848.png)
|
||||
![简单图床 - 广场界面](./install/README/3053540273.png)
|
||||
![简单图床 - 后台界面](./install/README/2657944724.png)
|
||||
![简单图床 - 统计界面](./install/README/1305032567.png)
|
||||
|
||||
## 兼容
|
||||
- 最低`PHP 5.6`,推荐`PHP 7.0`及以上版本,需要PHP支持`Fileinfo,iconv,zip,mbstring,openssl`扩展,如果缺失会导致无法上传/删除图片
|
||||
|
|
|
@ -255,7 +255,7 @@ if (isset($_GET['recycle_reimg'])) {
|
|||
<input type="checkbox" name="static_cdn" value="1" <?php if ($config['static_cdn']) echo 'checked="checked"'; ?>>
|
||||
<label style="font-weight: bold">静态文件CDN | 末尾不加'/'</label>
|
||||
</div>
|
||||
<input type="url" class="form-control" name="static_cdn_url" value="<?php echo $config['static_cdn_url']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')" data-toggle="tooltip" title="jsdelivr可添加当前版本号 例:@2.5.6">
|
||||
<input type="url" class="form-control" name="static_cdn_url" value="<?php echo $config['static_cdn_url']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')" data-toggle="tooltip" title="jsdelivr可在后边添加版本号 例:@2.5.6">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
|
@ -610,6 +610,13 @@ if (isset($_GET['recycle_reimg'])) {
|
|||
<label style="font-weight: bold">API 上传</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="switch switch-inline" data-toggle="tooltip" title="隐藏图片直链 | *注意: key与登录密码绑定,更改登录密码后key失效">
|
||||
<input type="hidden" name="hide" value="0">
|
||||
<input type="checkbox" name="hide" value="1" <?php if ($config['hide']) echo 'checked="checked"'; ?>>
|
||||
<label style="font-weight: bold">原图保护</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="switch switch-inline" data-toggle="tooltip" title="所有用户上传的图片使用加密链接删除后是否进入回收站">
|
||||
<input type="hidden" name="image_recycl" value="0">
|
||||
|
@ -677,8 +684,8 @@ if (isset($_GET['recycle_reimg'])) {
|
|||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="Content11">
|
||||
<h5>用户上传后自行删除的会显示在这个页面</h5>
|
||||
<p>为了访问速度,仅显示最近20张图片;图片回收需要在图床安全->图片回收中开启</p>
|
||||
<h5>用户自己删除的会显示在这个页面</h5>
|
||||
<p>为了访问速度,仅显示最近20张图片; 图片回收需要在图床安全->图片回收中开启</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered table-condensed table-striped">
|
||||
<thead>
|
||||
|
@ -785,8 +792,8 @@ if (isset($_GET['recycle_reimg'])) {
|
|||
<p class="text-ellipsis">剩余磁盘: <?php echo getDistUsed(disk_free_space(__DIR__)); ?></p>
|
||||
<h5>PHP信息</h5>
|
||||
<hr />
|
||||
<p class="text-ellipsis">PHP Version: <?php echo phpversion(); ?></p>
|
||||
<p class="text-ellipsis">GD Version: <?php echo (gd_info()["GD Version"]); ?></p>
|
||||
<p class="text-ellipsis">PHP: <?php echo phpversion(); ?></p>
|
||||
<p class="text-ellipsis">GD : <?php echo (gd_info()["GD Version"]); ?></p>
|
||||
<p class="text-ellipsis">PHP最大上传: <?PHP echo get_cfg_var("upload_max_filesize"); ?></p>
|
||||
<p class="text-ellipsis">POST最大上传: <?php echo ini_get('post_max_size'); ?></p>
|
||||
<p class="text-ellipsis">PHP最长执行时间: <?PHP echo get_cfg_var("max_execution_time") . "秒 "; ?></p>
|
||||
|
@ -794,23 +801,24 @@ if (isset($_GET['recycle_reimg'])) {
|
|||
<h5>我的信息</h5>
|
||||
<hr />
|
||||
<p class="text-ellipsis">浏览器: <?php echo $_SERVER['HTTP_USER_AGENT']; ?></p>
|
||||
<p class="text-ellipsis">我的IP: <?php echo $_SERVER["REMOTE_ADDR"]; ?></p>
|
||||
<p class="text-ellipsis">登录IP: <?php echo $_SERVER["REMOTE_ADDR"]; ?></p>
|
||||
<h5>图床信息</h5>
|
||||
<hr />
|
||||
<p class="text-ellipsis">
|
||||
<?php if (empty($config['TinyPng_key'])) : ?>
|
||||
<i class="icon icon-times" data-toggle="tooltip" title="图片压缩TinyPng未填写">TinyPng Key</i><br />
|
||||
<i class="icon icon-times" data-toggle="tooltip" title="图片压缩TinyPng未填写">TinyPng</i><br />
|
||||
<?php else : ?>
|
||||
<i class="icon icon-check" data-toggle="tooltip" title="图片压缩TinyPng已填写">TinyPng Key</i><br />
|
||||
<i class="icon icon-check" data-toggle="tooltip" title="图片压缩TinyPng已填写">TinyPng</i><br />
|
||||
<?php endif; ?>
|
||||
<?php if (empty($config['moderatecontent_key'])) : ?>
|
||||
<i class="icon icon-times" data-toggle="tooltip" title="图片审查moderatecontent未填写">moderatecontent key</i><br />
|
||||
<i class="icon icon-times" data-toggle="tooltip" title="图片审查moderatecontent未填写">moderatecontent</i><br />
|
||||
<?php else : ?>
|
||||
<i class="icon icon-check" data-toggle="tooltip" title="图片审查moderatecontent已填写">Moderatecontent Key</i><br />
|
||||
<i class="icon icon-check" data-toggle="tooltip" title="图片审查moderatecontent已填写">Moderatecontent</i><br />
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<p class="text-ellipsis">最新版本:<a href="https://github.com/icret/EasyImages2.0/releases" target="_blank"><span class="label label-badge label-success label-outline"><?php echo getVersion(); ?></span></a></p>
|
||||
<p class="text-ellipsis">当前版本:<span class="label label-badge label-outline"><?php echo $config['version']; ?></span></p>
|
||||
<p>
|
||||
<span class="label label-badge label-info">当前版本:<?php echo $config['version']; ?></span>
|
||||
<a href="https://github.com/icret/EasyImages2.0/releases" target="_blank"><span class="label label-badge label-success" data-toggle="tooltip" title="更新后删除<p>/admin/logs/verson/</p>文件夹会自动同步版本">最新版本:<?php echo getVersion(); ?></span></a> </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="Content9">
|
||||
|
|
|
@ -56,6 +56,9 @@ if ($handle->uploaded) {
|
|||
$pathIMG = config_path() . $handle->file_dst_name;
|
||||
$imageUrl = $config['imgurl'] . $pathIMG;
|
||||
|
||||
// 原图保护 key值是由crc32加密的登录密码
|
||||
$hide_original = $config['hide'] == 1 ? $config['domain'] . '/application/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['password'])) : $imageUrl;
|
||||
|
||||
// 关闭上传后显示加密删除链接
|
||||
if ($config['show_user_hash_del']) {
|
||||
// 判断PHP版本启用删除
|
||||
|
@ -79,10 +82,10 @@ if ($handle->uploaded) {
|
|||
echo json_encode($reJson, JSON_UNESCAPED_UNICODE);
|
||||
$handle->clean();
|
||||
} else {
|
||||
// 上传错误 code:403 客户端文件有问题
|
||||
// 上传错误 code:400 客户端文件有问题
|
||||
$reJson = array(
|
||||
"result" => "failed",
|
||||
"code" => 403,
|
||||
"code" => 400,
|
||||
"message" => $handle->error,
|
||||
);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ if ($config['password'] === 'e6e061838856bf47e1de730719fb2609') {
|
|||
<script>
|
||||
new $.zui.Messager("请修改默认密码,否则会有泄露风险! ",{
|
||||
type: "warning", // 定义颜色主题
|
||||
time:7000
|
||||
time:6000
|
||||
}).show();
|
||||
</script>
|
||||
';
|
||||
|
@ -83,14 +83,26 @@ if ($configp['checkImg'] !== 0) {
|
|||
if (file_exists(APP_ROOT . '/.user.ini')) {
|
||||
echo '
|
||||
<script>
|
||||
new $.zui.Messager("请关闭防跨目录读写或删除.user.ini文件 ",{
|
||||
new $.zui.Messager("请关闭防跨目录读写或删除.user.ini文件",{
|
||||
type: "danger", // 定义颜色主题
|
||||
time:10000
|
||||
time:7000
|
||||
}).show();
|
||||
</script>
|
||||
';
|
||||
}
|
||||
|
||||
// 检查当前版本与GitHub版本
|
||||
if (@getVersion() !== $config['version']) {
|
||||
echo '
|
||||
<script>
|
||||
new $.zui.Messager("当前版本与GitHub不一致,请检查当前是否最新版本!",{
|
||||
type: "danger", // 定义颜色主题
|
||||
time:9000
|
||||
}).show();
|
||||
</script>
|
||||
';
|
||||
}
|
||||
|
||||
// 检测是否开启登录上传
|
||||
if ($config['mustLogin']) {
|
||||
echo '
|
||||
|
|
|
@ -372,11 +372,16 @@ function getActive($url)
|
|||
* 加密/解密图片路径
|
||||
* @param string $data 要加密的内容
|
||||
* @param int $mode =1或0 1解密 0加密
|
||||
* @param String $key 盐
|
||||
*/
|
||||
function urlHash($data, $mode)
|
||||
function urlHash($data, $mode, $key = null)
|
||||
{
|
||||
global $config;
|
||||
$key = $config['password'];
|
||||
|
||||
if ($key) {
|
||||
$key = $config['password'];
|
||||
}
|
||||
|
||||
$iv = 'sciCuBC7orQtDhTO';
|
||||
if ($mode) {
|
||||
return openssl_decrypt(base64_decode($data), "AES-128-CBC", $key, 0, $iv);
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Program: EasyImage2.0
|
||||
* Author: Icret
|
||||
* Date: 2022/3/13 20:11
|
||||
* For: 原图保护解密
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/function.php';
|
||||
|
||||
if (isset($_GET['key'])) {
|
||||
$hide_original = $_GET['key'];
|
||||
$real_path = APP_ROOT . urlHash($hide_original, 1, crc32($config['password']));
|
||||
} else {
|
||||
$real_path = APP_ROOT . '/public/images/404.png';
|
||||
}
|
||||
|
||||
// 文件不存在
|
||||
if (!is_file($real_path)) {
|
||||
$real_path = APP_ROOT . '/public/images/404.png';
|
||||
}
|
||||
|
||||
// 获取文件后缀
|
||||
$ex = pathinfo($real_path, PATHINFO_EXTENSION);
|
||||
|
||||
// 设置头
|
||||
header("Content-Type: image/" . $ex . ";text/html; charset=utf-8");
|
||||
|
||||
//输出文件
|
||||
echo file_get_contents($real_path);
|
||||
|
||||
exit;
|
|
@ -64,6 +64,9 @@ if ($handle->uploaded) {
|
|||
$pathIMG = config_path() . $handle->file_dst_name;
|
||||
$imageUrl = $config['imgurl'] . $pathIMG;
|
||||
|
||||
// 原图保护 key值是由crc32加密的登录密码
|
||||
$hide_original = $config['hide'] == 1 ? $config['domain'] . '/application/hide.php?key=' . urlHash($pathIMG, 0, crc32($config['password'])) : $imageUrl;
|
||||
|
||||
// 关闭上传后显示加密删除链接
|
||||
if ($config['show_user_hash_del']) {
|
||||
// 判断PHP版本启用删除
|
||||
|
@ -79,7 +82,7 @@ if ($handle->uploaded) {
|
|||
$reJson = array(
|
||||
"result" => "success",
|
||||
"code" => 200,
|
||||
"url" => $imageUrl,
|
||||
"url" => $hide_original,
|
||||
"srcName" => $handle->file_src_name_body,
|
||||
"thumb" => $config['domain'] . '/application/thumb.php?img=' . $pathIMG,
|
||||
"del" => $delUrl,
|
||||
|
@ -95,7 +98,6 @@ if ($handle->uploaded) {
|
|||
);
|
||||
unset($handle);
|
||||
header('Content-Type:application/json; charset=utf-8');
|
||||
unset($handle);
|
||||
exit(json_encode($reJson, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ $config=Array
|
|||
'imgRatio_preserve_headers'=>1,
|
||||
'static_cdn'=>0,
|
||||
'theme'=>'default',
|
||||
'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.5.5',
|
||||
'static_cdn_url'=>'https://cdn.jsdelivr.net/gh/icret/EasyImages2.0@2.5.6',
|
||||
'TinyPng_key'=>'',
|
||||
'checkImg'=>0,
|
||||
'checkImg_value'=>50,
|
||||
|
@ -63,9 +63,9 @@ var _hmt = _hmt || [];
|
|||
<a href="https://app.cloudcone.com.cn/?ref=3521" target="_blank"><img src="/public/images/EasyImage2.0.png" /></a>
|
||||
</div>',
|
||||
'ad_bot'=>0,
|
||||
'ad_bot_info'=>'<div class="col-md-12" style="text-align: center;padding:12px 0 90px 0;">
|
||||
<a href="../public/images/wechat.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#329d38;" data-lightbox-group="group1644998953432"><i class="icon icon-wechat"></i> 打赏作者</a>
|
||||
<a href="../public/images/alipay.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#1970fc;" data-lightbox-group="group1644998953432"><i class="icon icon-zhifubao"></i> 打赏作者</a>
|
||||
'ad_bot_info'=>'<div class="col-md-12" style="text-align: center;padding:12px 0 110px 0;">
|
||||
<a href="../public/images/wechat.jpg" alt="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#329d38;" data-lightbox-group="group1644998953432"><i class="icon icon-wechat"></i> 打赏作者</a>
|
||||
<a href="../public/images/alipay.jpg" alt="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#1970fc;" data-lightbox-group="group1644998953432"><i class="icon icon-zhifubao"></i> 打赏作者</a>
|
||||
</div>',
|
||||
'showSwitch'=>1,
|
||||
'showSort'=>1,
|
||||
|
@ -98,8 +98,9 @@ var _hmt = _hmt || [];
|
|||
'language'=>0,
|
||||
'image_recycl'=>1,
|
||||
'delDir'=>'thumbnails/',
|
||||
'version'=>'2.5.5',
|
||||
'update'=>'2022-03-12 14:03:59',
|
||||
'hide'=>0,
|
||||
'version'=>'2.5.6',
|
||||
'update'=>'2022-03-14 17:48:22',
|
||||
'terms'=>'<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
After Width: | Height: | Size: 143 KiB |
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Loading…
Reference in New Issue