- 上传组件支持到 PHP 8.2
- 修复下载任意文件漏洞 [#75](https://github.com/icret/EasyImages2.0/issues/75)
- 增加自定义底部信息
- 增加自定义管理提示
- 增加图床模式
  - 危险:除图片外不验证文件是否正常,也代表可以上传任意指定格式!
- 增加上传时生成缩略图(仅设置直链缩略图时生效),低配vps负载较大,影响前端上传速度!
- 其他一些优化
pull/141/head 2.6.8
icret 2022-12-30 02:58:26 +08:00 committed by GitHub
parent 4fae3bd291
commit cbaf3a30ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 1307 additions and 1429 deletions

View File

@ -3,6 +3,7 @@
演示地址:[https://png.cm/](https://png.cm/)
之前一直用的图床程序是:[PHP多图长传程序2.4.3](https://www.jb51.net/codes/40544.html)
由于版本过老并且使用falsh上传在当前html5流行大势所趋下遂利用基础知识新写了一个以html5为默认上传并且支持flash,向下兼容至IE9。
***本程序环境要求极低,适用于单一场景(游客上传)和个人使用,不适于多用户复杂场景***
[![EasyImage2.0 GitHub's stars](https://img.shields.io/github/stars/icret/easyImage2.0?style=social)](https://github.com/icret/EasyImages2.0/stargazers)
[![EasyImage2.0 GitHub's forks](https://img.shields.io/github/forks/icret/easyimage2.0?style=social)](https://github.com/icret/EasyImages2.0/network/members)
@ -41,7 +42,8 @@
- [x] 支持自定义代码
- [x] 支持上传IP黑白名单
- [x] 支持创建仅上传用户
- [x] 更多支持请安装尝试···
- [x] 对于安装环境要求极低
- [x] 更多功能支持请安装尝试···
## 安装
> 推荐环境Nginx + PHP≥7.0 + linux
@ -50,12 +52,12 @@
#### Linux:
- `git clone https://github.com/icret/EasyImages2.0.git`web目录
- `git clone https://github.com/icret/EasyImages2.0.git`安装目录
- 赋予web目录www:www和0755权限:
- 赋予安装目录www:www和0755权限:
```shell
chmod 755 -R /web目录
chown -R www:www /web目录
chmod -R 755 /安装目录
chown -R www:www /安装目录
```
#### BT宝塔面板
@ -77,8 +79,9 @@ chown -R www:www /web目录
9. `undefined function imagecreatefromwebp()`GD没安装webp, 以此类推
10. `Warning: is_dir(): open_basedir restriction in effect`解决方法同`3`
11. 无法上传/访问/不显示验证码: 1. 权限问题见问题`1` 2. CDN缓存了 3. 开防火墙了
12. `Fatal error: Allowed memory size......`主机内存或分配给PHP的内存不够 解决方法百度
13. 开启原图保护功能后打开图片链接显示`404`是因为`nginx`或`Apache`页面缓存导致的,`Nginx`解决办法:
12. 宝塔或者其他环境安装成功但是上传失败,多数原因是防火墙拦截上传,取消拦截即可
13. `Fatal error: Allowed memory size......`主机内存或分配给PHP的内存不够 解决方法百度
14. 开启原图保护功能后打开图片链接显示`404`是因为`nginx`或`Apache`页面缓存导致的,`Nginx`解决办法:
```Nginx
# 把Nginx这段配置删掉
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
@ -180,10 +183,20 @@ $HTTP["url"] =~ "^/(i|public)/" {
<details><summary>点击查看2.0版更新日志</summary>
* 2022-12-30 v2.6.8
- 上传组件支持到 PHP 8.2
- 修复下载任意文件漏洞 [#75](https://github.com/icret/EasyImages2.0/issues/75)
- 增加自定义底部信息
- 增加自定义管理提示
- 增加图床模式
- 危险:除图片外不验证文件是否正常,也代表可以上传任意指定格式!
- 增加上传时生成缩略图(仅设置直链缩略图时生效)低配vps负载较大,影响前端上传速度!
- 其他一些优化
* 2022-09-20 v2.6.7
- 优化后台显示
- 增加控制缩略图尺寸
- 修复启用Opcache带来的问题 [#57](https://github.com/icret/EasyImages2.0/issues/)
- 修复启用Opcache带来的问题 [#57](https://github.com/icret/EasyImages2.0/issues/57)
* 2022-07-10 v2.6.6
- 增加文件uuid命名

View File

@ -237,17 +237,7 @@ if (isset($_GET['recycle_reimg'])) {
}
?>
<div class="row">
<div class="alert alert-primary alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button>
<h5>目录保存以 /// 递进,非必要请勿修改! 否则会导致部分操作不可用;</h5>
<h5>本人仅为程序开源创作,如遇非法网站使用与本人无关,请勿用于商业用途;</h5>
<h5>作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中源作者信息。</h5>
<a href="https://png.cm/?admin.inc" target="_blank"><button type="button" class="btn btn-mini"><i class="icon icon-external-link"></i> 演示网站</button></a>
<a href="https://www.kancloud.cn/easyimage/easyimage/content" target="_blank"><button type="button" class="btn btn-mini"><i class="icon icon-hand-right"></i> 使用手册</button></a>
<a href="https://t.me/Easy_Image" target="_blank" data-toggle="tooltip" title="EasyImage Telegram Group"><button type="button" class="btn btn-mini"><i class="icon icon-plane"></i> Telegram</button></a>
<a href="../public/images/wechat.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#329d38;"><i class="icon icon-wechat"></i> 打赏作者</a>
<a href="../public/images/alipay.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini hidden-xs inline-block" style="color:#1970fc;"><i class="icon icon-zhifubao"></i> 打赏作者</a>
</div>
<?php echo $config['set_notice'];?>
<div class="col-md-2 col-xs-4">
<ul class="nav nav-tabs nav-stacked">
<li><a data-tab href="#Content1">网站设置</a></li>
@ -290,7 +280,7 @@ if (isset($_GET['recycle_reimg'])) {
<textarea class="form-control" rows="2" name="description" required="required" onkeyup="this.value=this.value.replace(/\s/g,'')"><?php echo $config['description']; ?></textarea>
</div>
<div class="form-group">
<label data-toggle="tooltip" title="不同公告以a标签分割">网站公告 | 支持html</label>
<label data-toggle="tooltip" title="不同公告以a标签换行分割">滚动公告 | 支持html</label>
<textarea class="form-control" rows="2" name="tips"><?php echo $config['tips']; ?></textarea>
</div>
<div class="form-group">
@ -305,6 +295,10 @@ if (isset($_GET['recycle_reimg'])) {
<label data-toggle="tooltip" title="HTML / 统计代码 / JS / CSS">页脚代码 | 需闭合标签</label>
<textarea class="form-control" rows="2" name="footer"><?php echo $config['footer']; ?></textarea>
</div>
<div class="form-group">
<label data-toggle="tooltip" title="管理页面顶部提示信息, 可用于一些备注">管理提示 | 支持html</label>
<textarea class="form-control" rows="2" name="set_notice" placeholder="管理设置页面的提示信息"><?php echo $config['set_notice']; ?></textarea>
</div>
<div class="form-group">
<label data-toggle="tooltip" title="服务条款 / 隐私政策 / DMCA">使用条款| 支持HTML</label>
<textarea class="form-control" rows="2" name="terms"><?php echo $config['terms']; ?></textarea>
@ -326,7 +320,7 @@ if (isset($_GET['recycle_reimg'])) {
<input type="text" class="form-control" name="mime" required="required" value="php echo $config['mime'];" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div> -->
<div class="form-group col-md-5">
<label data-toggle="tooltip" title="请以英文 , 分割 最后一个扩展名后边加 ,">允许的扩展名</label>
<label data-toggle="tooltip" title="请以英文 , 分割 最后一个不加 , <br/>想上传图片以外的格式?请关闭图床安全->图床模式">允许的扩展名</label>
<input type="text" class="form-control" name="extensions" required="required" value="<?php echo $config['extensions']; ?>" onkeyup="this.value=this.value.replace(/\s/g,'')">
</div>
<div class="form-group col-md-4">
@ -493,13 +487,13 @@ if (isset($_GET['recycle_reimg'])) {
<div class="form-group col-md-6">
<label>缩略图生成方式</label>
<div class="radio-primary">
<input type="radio" name="thumbnail" value="0" <?php if ($config['thumbnail'] === 0) echo 'checked="checked"'; ?> id="thumbnail0"><label for="thumbnail0" data-toggle="tooltip" title="直接输出上传图片,会导致流量增加"> 关闭</label>
<input type="radio" name="thumbnail" value="0" <?php if ($config['thumbnail'] === 0) echo 'checked="checked"'; ?> id="thumbnail0"><label for="thumbnail0" data-toggle="tooltip" title="直接输出上传图片,会导致流量增加"> 原图</label>
</div>
<div class="radio-primary">
<input type="radio" name="thumbnail" value="1" <?php if ($config['thumbnail'] === 1) echo 'checked="checked"'; ?> id="thumbnail1"><label for="thumbnail1" data-toggle="tooltip" title="利用TimThumb生成 | 优点: 带缓存周期 | 缺点: 无法被cdn缓存"> 访问生成 | 推荐</label>
<input type="radio" name="thumbnail" value="1" <?php if ($config['thumbnail'] === 1) echo 'checked="checked"'; ?> id="thumbnail1"><label for="thumbnail1" data-toggle="tooltip" title="利用TimThumb生成 | 优点: 带缓存周期 | 缺点: cdn无法缓存"> 访问生成 | 推荐</label>
</div>
<div class="radio-primary">
<input type="radio" name="thumbnail" value="2" <?php if ($config['thumbnail'] === 2) echo 'checked="checked"'; ?> id="thumbnail2"><label for="thumbnail2" data-toggle="tooltip" title="优点: 缩略图直链 | 缺点: 每日首次访问广场需刷新一次,有缓存不失效"> 访问生成 | 直链</label>
<input type="radio" name="thumbnail" value="2" <?php if ($config['thumbnail'] === 2) echo 'checked="checked"'; ?> id="thumbnail2"><label for="thumbnail2" data-toggle="tooltip" title="优点: 缩略图直链 | 缺点: 缓存不失效, 低配vps负载较大,影响前端上传速度"> 访问生成 | 直链</label>
</div>
</div>
<div class="form-group col-md-6">
@ -646,7 +640,17 @@ if (isset($_GET['recycle_reimg'])) {
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-2">
<div class="switch switch-inline" data-toggle="tooltip" title="危险:关闭后除图片外不验证文件是否正常,代表可以上传任意指定格式!">
<input type="hidden" name="allowed" value="0">
<input type="checkbox" name="allowed" value="1" <?php if ($config['allowed']) echo 'checked="checked"'; ?>>
<label style="font-weight: bold">图床模式</label>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="switch switch-inline" data-toggle="tooltip" title="建议开启,有效防止因撞库导致账户密码被破解!">
<input type="hidden" name="captcha" value="0">

View File

@ -1 +1 @@
2.6.7
2.6.8

View File

@ -94,7 +94,7 @@ if ($handle->uploaded) {
// 图片完整相对路径:/i/2021/05/03/k88e7p.jpg
if ($handle->processed) {
header('Content-type:text/json');
// 上传成功后返回json数据
// 图片相对路径
$pathIMG = $Img_path . $handle->file_dst_name;
// 图片访问网址
@ -132,6 +132,28 @@ if ($handle->uploaded) {
$delUrl = "Admin closed delete";
}
// 当设置访问生成缩略图时自动生成 2022-12-30
if($config['thumbnail'] == 2) {
// 自定义缩略图长宽
$thumbnail_w = 258;
$thumbnail_h = 258;
$handle->image_resize = true;
if (!empty($config['thumbnail_w']) || !empty($config['thumbnail_h'])) {
$handle->image_x = $config['thumbnail_w'];
$handle->image_y = $config['thumbnail_h'];
}
// 如果调整后的图像大于原始图像,则取消调整大小,以防止放大
$handle->image_no_enlarging = true;
$handle->file_new_name_body = date('Y_m_d_') . $handle->file_dst_name_body;
$handle->process(APP_ROOT . $config['path']. 'thumbnails/');
}
// 上传成功后返回json数据
$reJson = array(
"result" => "success",
"code" => 200,

View File

@ -500,6 +500,14 @@ class Upload {
*/
var $file_max_size;
/**
* Max file size, from php.ini
*
* @access private
* @var double
*/
var $file_max_size_raw;
/**
* Set this variable to true to resize the file if it is an image
*
@ -2109,7 +2117,7 @@ class Upload {
*/
function upload($file, $lang = 'en_GB') {
$this->version = '13/06/2022';
$this->version = '30/08/2022';
$this->file_src_name = '';
$this->file_src_name_body = '';
@ -2926,6 +2934,7 @@ class Upload {
* @return resource Container image
*/
function imagecreatenew($x, $y, $fill = true, $trsp = false) {
$x = (int) $x; $y = (int) $y;
if ($x < 1) $x = 1; if ($y < 1) $y = 1;
if ($this->gdversion() >= 2 && !$this->image_is_palette) {
// create a true color image
@ -3913,6 +3922,8 @@ class Upload {
// resize the image
if ($this->image_dst_x != $this->image_src_x || $this->image_dst_y != $this->image_src_y) {
$this->image_dst_x = (int) $this->image_dst_x;
$this->image_dst_y = (int) $this->image_dst_y;
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y);
if ($gd_version >= 2) {
@ -4077,8 +4088,9 @@ class Upload {
$p_new['red'] = (abs($p_orig['red'] - $p_blur['red']) >= $this->image_unsharp_threshold) ? max(0, min(255, ($this->image_unsharp_amount * ($p_orig['red'] - $p_blur['red'])) + $p_orig['red'])) : $p_orig['red'];
$p_new['green'] = (abs($p_orig['green'] - $p_blur['green']) >= $this->image_unsharp_threshold) ? max(0, min(255, ($this->image_unsharp_amount * ($p_orig['green'] - $p_blur['green'])) + $p_orig['green'])) : $p_orig['green'];
$p_new['blue'] = (abs($p_orig['blue'] - $p_blur['blue']) >= $this->image_unsharp_threshold) ? max(0, min(255, ($this->image_unsharp_amount * ($p_orig['blue'] - $p_blur['blue'])) + $p_orig['blue'])) : $p_orig['blue'];
$p_new['alpha'] = max(-127, min(127, $p_orig['alpha']));
if (($p_orig['red'] != $p_new['red']) || ($p_orig['green'] != $p_new['green']) || ($p_orig['blue'] != $p_new['blue'])) {
$color = imagecolorallocatealpha($image_dst, $p_new['red'], $p_new['green'], $p_new['blue'], $p_orig['alpha']);
$color = imagecolorallocatealpha($image_dst, (int) $p_new['red'], (int) $p_new['green'], (int) $p_new['blue'], (int) $p_new['alpha']);
imagesetpixel($image_dst, $x, $y, $color);
}
}
@ -4094,7 +4106,8 @@ class Upload {
if ($p_new['green']>255) { $p_new['green']=255; } elseif ($p_new['green']<0) { $p_new['green']=0; }
$p_new['blue'] = ($this->image_unsharp_amount * ($p_orig['blue'] - $p_blur['blue'])) + $p_orig['blue'];
if ($p_new['blue']>255) { $p_new['blue']=255; } elseif ($p_new['blue']<0) { $p_new['blue']=0; }
$color = imagecolorallocatealpha($image_dst, $p_new['red'], $p_new['green'], $p_new['blue'], $p_orig['alpha']);
$p_new['alpha'] = round(max(-127, min(127, $p_orig['alpha'])));
$color = imagecolorallocatealpha($image_dst, (int) $p_new['red'], (int) $p_new['green'], (int) $p_new['blue'], (int) $p_new['alpha']);
imagesetpixel($image_dst, $x, $y, $color);
}
}
@ -4125,7 +4138,8 @@ class Upload {
if ($this->image_greyscale) {
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
$r = $g = $b = round((0.2125 * $pixel['red']) + (0.7154 * $pixel['green']) + (0.0721 * $pixel['blue']));
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
$alpha = round(max(-127, min(127, $pixel['alpha'])));
$color = imagecolorallocatealpha($image_dst, (int) $r, (int) $g, (int) $b, (int) $alpha);
imagesetpixel($image_dst, $x, $y, $color);
unset($color); unset($pixel);
}
@ -4133,7 +4147,8 @@ class Upload {
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
$c = (round($pixel['red'] + $pixel['green'] + $pixel['blue']) / 3) - 127;
$r = $g = $b = ($c > $this->image_threshold ? 255 : 0);
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
$alpha = round(max(-127, min(127, $pixel['alpha'])));
$color = imagecolorallocatealpha($image_dst, (int) $r, (int) $g, (int) $b, (int) $alpha);
imagesetpixel($image_dst, $x, $y, $color);
unset($color); unset($pixel);
}
@ -4142,7 +4157,8 @@ class Upload {
$r = max(min(round($pixel['red'] + (($this->image_brightness * 2))), 255), 0);
$g = max(min(round($pixel['green'] + (($this->image_brightness * 2))), 255), 0);
$b = max(min(round($pixel['blue'] + (($this->image_brightness * 2))), 255), 0);
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
$alpha = round(max(-127, min(127, $pixel['alpha'])));
$color = imagecolorallocatealpha($image_dst, (int) $r, (int) $g, (int) $b, (int) $alpha);
imagesetpixel($image_dst, $x, $y, $color);
unset($color); unset($pixel);
}
@ -4151,7 +4167,8 @@ class Upload {
$r = max(min(round(($this->image_contrast + 128) * $pixel['red'] / 128), 255), 0);
$g = max(min(round(($this->image_contrast + 128) * $pixel['green'] / 128), 255), 0);
$b = max(min(round(($this->image_contrast + 128) * $pixel['blue'] / 128), 255), 0);
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
$alpha = round(max(-127, min(127, $pixel['alpha'])));
$color = imagecolorallocatealpha($image_dst, (int) $r, (int) $g, (int) $b, (int) $alpha);
imagesetpixel($image_dst, $x, $y, $color);
unset($color); unset($pixel);
}
@ -4160,7 +4177,8 @@ class Upload {
$r = min(round($tint_red * $pixel['red'] / 169), 255);
$g = min(round($tint_green * $pixel['green'] / 169), 255);
$b = min(round($tint_blue * $pixel['blue'] / 169), 255);
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
$alpha = round(max(-127, min(127, $pixel['alpha'])));
$color = imagecolorallocatealpha($image_dst, (int) $r, (int) $g, (int) $b, (int) $alpha);
imagesetpixel($image_dst, $x, $y, $color);
unset($color); unset($pixel);
}
@ -4169,7 +4187,8 @@ class Upload {
$r = round(255 - $pixel['red']);
$g = round(255 - $pixel['green']);
$b = round(255 - $pixel['blue']);
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
$alpha = round(max(-127, min(127, $pixel['alpha'])));
$color = imagecolorallocatealpha($image_dst, (int) $r, (int) $g, (int) $b, (int) $alpha);
imagesetpixel($image_dst, $x, $y, $color);
unset($color); unset($pixel);
}
@ -4330,7 +4349,7 @@ class Upload {
// add watermark image
if ($this->image_watermark!='' && file_exists($this->image_watermark)) {
$this->log .= '- add watermark<br />';
$this->image_watermark_position = strtolower($this->image_watermark_position);
$this->image_watermark_position = strtolower((string) $this->image_watermark_position);
$watermark_info = getimagesize($this->image_watermark);
$watermark_type = (array_key_exists(2, $watermark_info) ? $watermark_info[2] : null); // 1 = GIF, 2 = JPG, 3 = PNG
$watermark_checked = false;
@ -4404,8 +4423,8 @@ class Upload {
// if watermark is too large/tall, resize it first
if ((!$this->image_watermark_no_zoom_out && ($watermark_dst_width > $this->image_dst_x || $watermark_dst_height > $this->image_dst_y))
|| (!$this->image_watermark_no_zoom_in && $watermark_dst_width < $this->image_dst_x && $watermark_dst_height < $this->image_dst_y)) {
$canvas_width = $this->image_dst_x - abs($this->image_watermark_x);
$canvas_height = $this->image_dst_y - abs($this->image_watermark_y);
$canvas_width = $this->image_dst_x - abs((int) $this->image_watermark_x);
$canvas_height = $this->image_dst_y - abs((int) $this->image_watermark_y);
if (($watermark_src_width/$canvas_width) > ($watermark_src_height/$canvas_height)) {
$watermark_dst_width = $canvas_width;
$watermark_dst_height = intval($watermark_src_height*($canvas_width / $watermark_src_width));
@ -4527,9 +4546,9 @@ class Upload {
if (!is_numeric($this->image_text_line_spacing)) $this->image_text_line_spacing = 0;
if (!is_numeric($this->image_text_padding_x)) $this->image_text_padding_x = $this->image_text_padding;
if (!is_numeric($this->image_text_padding_y)) $this->image_text_padding_y = $this->image_text_padding;
$this->image_text_position = strtolower($this->image_text_position);
$this->image_text_direction = strtolower($this->image_text_direction);
$this->image_text_alignment = strtolower($this->image_text_alignment);
$this->image_text_position = strtolower((string) $this->image_text_position);
$this->image_text_direction = strtolower((string) $this->image_text_direction);
$this->image_text_alignment = strtolower((string) $this->image_text_alignment);
$font_type = 'gd';
@ -4596,8 +4615,8 @@ class Upload {
$maxX = max(array($rect[0],$rect[2],$rect[4],$rect[6]));
$minY = min(array($rect[1],$rect[3],$rect[5],$rect[7]));
$maxY = max(array($rect[1],$rect[3],$rect[5],$rect[7]));
$text_offset_x = abs($minX) - 1;
$text_offset_y = abs($minY) - 1;
$text_offset_x = abs($minX);
$text_offset_y = abs($minY);
$text_width = $maxX - $minX + (2 * $this->image_text_padding_x);
$text_height = $maxY - $minY + (2 * $this->image_text_padding_y);
}
@ -4670,15 +4689,15 @@ class Upload {
if ($this->image_text_direction == 'v') {
imagestringup($filter,
$this->image_text_font,
$k * ($line_width + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)),
$text_height - (2 * $this->image_text_padding_y) - ($this->image_text_alignment == 'l' ? 0 : (($t_height - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))) ,
(int) ($k * ($line_width + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0))),
(int) ($text_height - (2 * $this->image_text_padding_y) - ($this->image_text_alignment == 'l' ? 0 : (($t_height - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2)))),
$v,
$text_color);
} else {
imagestring($filter,
$this->image_text_font,
($this->image_text_alignment == 'l' ? 0 : (($t_width - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))),
$k * ($line_height + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)),
(int) ($this->image_text_alignment == 'l' ? 0 : (($t_width - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))),
(int) ($k * ($line_height + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0))),
$v,
$text_color);
}

View File

@ -5,17 +5,38 @@
* https://www.php.cn/php-weizijiaocheng-394566.html
*/
//获取要下载的文件名
require_once __DIR__.'/function.php';
// 获取下载路径
if (empty($_GET['dw'])) {
exit('No File');
exit('No File Path');
}else{
$dw = '../' . $_GET['dw'];
// 检查文件是否存在
if(!is_file($dw)){
exit('No File');
}
}
$dw = '../' . $_GET['dw'];
// 过滤下载非指定上传文件格式
$dw_extension = pathinfo($dw,PATHINFO_EXTENSION);
$filter_extensions = explode(',',$config['extensions']);
// 过滤下载其他格式
$filter_other = array('php','json','log');
// 先过滤后下载
if(in_array($dw_extension,$filter_extensions) && !in_array($dw_extension,$filter_other)){
//设置头信息
header('Content-Disposition:attachment;filename=' . basename($dw));
header('Content-Length:' . filesize($dw));
//读取文件并写入到输出缓冲
readfile($dw);
exit;
}else{
exit('Downfile Type Error');
}
//设置头信息
header('Content-Disposition:attachment;filename=' . basename($dw));
header('Content-Length:' . filesize($dw));
//读取文件并写入到输出缓冲
readfile($dw);
exit;

View File

@ -974,9 +974,9 @@ function get_online_thumbnail($imgUrl)
if ($config['thumbnail']) {
$imgUrl = str_replace($config['domain'], '', $imgUrl);
return $config['domain'] . '/application/thumb.php?img=' . $imgUrl;
} else {
return $imgUrl;
}
return $imgUrl;
}
/**
@ -988,15 +988,17 @@ function creat_thumbnail_by_list($imgUrl)
{
global $config;
ini_set('max_execution_time', '60'); // 脚本运行的时间以秒为单位0不限制
ini_set('max_execution_time', '300'); // 脚本运行的时间以秒为单位0不限制
// 关闭缩略图
if ($config['thumbnail'] === 0) {
return $imgUrl;
}
// 实时生成
if ($config['thumbnail'] === 1) {
return get_online_thumbnail($imgUrl);
switch ($config['thumbnail']){
// 输出原图
case 0:
return $imgUrl;
break;
// 访问生成
case 1:
return get_online_thumbnail($imgUrl);
break;
}
// 将网址图片转换为相对路径
@ -1012,7 +1014,7 @@ function creat_thumbnail_by_list($imgUrl)
$imgName = str_replace('/', '_', $pathName);
// 缓存文件是否存在
if (file_exists(APP_ROOT . $config['path'] . 'thumbnails/' . $imgName)) {
if (is_file(APP_ROOT . $config['path'] . 'thumbnails/' . $imgName)) {
// 存在则返回缓存文件
return $config['domain'] . $config['path'] . 'thumbnails/' . $imgName;
} else {
@ -1028,7 +1030,7 @@ function creat_thumbnail_by_list($imgUrl)
}
// 过滤非指定格式
if (!in_array(pathinfo(basename($abPathName), PATHINFO_EXTENSION), array('png', 'gif', 'jpeg', 'jpg', 'webp', 'bmp'))) {
if (!in_array(pathinfo(basename($abPathName), PATHINFO_EXTENSION), array('png', 'gif', 'jpeg', 'jpg', 'webp', 'bmp' ,'ico'))) {
return $imgUrl;
}
@ -1398,5 +1400,5 @@ function get_current_verson($file = '/admin/verson.txt')
return file_get_contents($file);
}
return 'No Verson';
}
return 'No Verson File';
}

View File

@ -84,5 +84,3 @@
$translation['no_conversion_type'] = 'No conversion type defined.';
$translation['copy_failed'] = 'Error copying file on the server. copy() failed.';
$translation['reading_failed'] = 'Error reading the file.';
?>

View File

@ -82,5 +82,3 @@
$translation['no_conversion_type'] = <><CEB4><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['copy_failed'] = '<27>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ļ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> copy() <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>.';
$translation['reading_failed'] = '<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD>';
?>

View File

@ -81,5 +81,3 @@
$translation['no_conversion_type'] = '未定义转换类型';
$translation['copy_failed'] = '在服务器上复制文件时出错。 copy() 操作失败.';
$translation['reading_failed'] = '读取过程中出错。';
?>

View File

@ -84,4 +84,3 @@
$translation['no_conversion_type'] = '未定義的轉換類型。';
$translation['copy_failed'] = '在伺服端複製檔案時出錯copy() 操作失敗。';
$translation['reading_failed'] = '讀檔過程中出錯。';
?>

View File

@ -146,4 +146,4 @@ function write_log($filePath, $sourceName, $absolutePath, $fileSize, $from = "we
$log = array_replace($logs, $log);
cache_write($logFileName, $log, 'logs');
}
}

View File

@ -43,7 +43,10 @@ $handle = new Upload($_FILES['file'], 'zh_CN');
if ($handle->uploaded) {
// 允许上传的mime类型
$handle->allowed = array('image/*');
if($config['allowed'] === 1){
$handle->allowed = array('image/*');
}
// 文件命名
$handle->file_new_name_body = imgName($handle->file_src_name_body);
@ -107,7 +110,7 @@ if ($handle->uploaded) {
}
}
// 存储图片路径:images/201807/
// 存储图片路径:i/201807/
$handle->process(APP_ROOT . $Img_path);
// 图片完整相对路径:/i/2021/05/03/k88e7p.jpg
@ -149,6 +152,27 @@ if ($handle->uploaded) {
$delUrl = "Admin closed delete";
}
// 当设置访问生成缩略图时自动生成 2022-12-30
if($config['thumbnail'] == 2) {
// 自定义缩略图长宽
$thumbnail_w = 258;
$thumbnail_h = 258;
$handle->image_resize = true;
if (!empty($config['thumbnail_w']) || !empty($config['thumbnail_h'])) {
$handle->image_x = $config['thumbnail_w'];
$handle->image_y = $config['thumbnail_h'];
}
// 如果调整后的图像大于原始图像,则取消调整大小,以防止放大
$handle->image_no_enlarging = true;
$handle->file_new_name_body = date('Y_m_d_') . $handle->file_dst_name_body;
$handle->process(APP_ROOT . $config['path']. 'thumbnails/');
}
// 上传成功后返回json数据
$reJson = array(
"result" => "success",
@ -159,7 +183,7 @@ if ($handle->uploaded) {
"del" => $delUrl,
);
echo json_encode($reJson);
$handle->clean();
$handle->clean(); // 如果取消上传生成缩略图需要恢复此选项功能
} else {
// 上传错误 code:206 客户端文件有问题
$reJson = array(
@ -174,6 +198,7 @@ if ($handle->uploaded) {
/** 后续处理 */
require __DIR__ . '/process.php';
// 使用fastcgi_finish_request操作
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
@ -185,7 +210,7 @@ if ($handle->uploaded) {
@water($handle->file_dst_pathname);
// 压缩
@compress($handle->file_dst_pathname);
} else {
} else {
// 普通模式鉴黄
@process_checkImg($processUrl);
// 日志
@ -195,5 +220,6 @@ if ($handle->uploaded) {
// 压缩
@compress($handle->file_dst_pathname);
}
unset($handle);
}

View File

@ -4,7 +4,7 @@ $guestConfig=Array
'guest'=>Array
(
'password'=>'084e0343a0486ff05530df6c705c8bb4',
'expired'=>1966793308,
'add_time'=>1651433308
'expired'=>2536242924,
'add_time'=>1672329324
)
);

View File

@ -4,19 +4,30 @@ $config=Array
'title'=>'简单图床 - EasyImage',
'keywords'=>'简单图床,easyimage,easyimage2.0,无数据库图床,免费图床,PHP多图长传程序,自适应页面,一键复制链接,HTML5,markdown,bbscode',
'description'=>'简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序,最新html5自适应页面兼容手机电脑,上传后返回图片直链,markdown图片,论坛贴图bbscode链接,简单方便支持一键复制,支持多域名,api上传',
'tips'=>'<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-github"> 如果你喜欢这种图床风格就下载喔 (๑•̀ㅂ•́)و✧</i></a>
<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-heart"> 简单图床是一款开源图床, 支持多文件上传无数据库</i></a>
'tips'=>'<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-github"> 如果你喜欢这种图床风格就下载喔 (๑•̀ㅂ•́)و✧</i></a>
<a href="https://github.com/icret/EasyImages2.0" target="_black"><i class="icon icon-heart"> 简单图床是一款开源图床, 支持多文件上传无数据库</i></a>
<a><li class="icon icon-bullhorn text-muted"> 单文件≤10M,单次上传≤30张</li></a>',
'notice_status'=>0,
'notice'=>'<p>简单图床是一款开源图床, 支持多文件上传无数据库;</p>
'notice'=>'<p>简单图床是一款开源图床, 支持多文件上传无数据库;</p>
<p>如果你喜欢这种图床风格就<a href="https://github.com/icret/EasyImages2.0" target="_black">下载</a> (๑•̀ㅂ•́)و✧</p>',
'set_notice'=>'<div class="alert alert-primary alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button>
<h5>目录保存以 /// 递进,非必要请勿修改! 否则会导致部分操作不可用;</h5>
<h5>本人仅为程序开源创作,如遇非法网站使用与本人无关,请勿用于商业用途;</h5>
<h5>作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中源作者信息。</h5>
<a href="https://png.cm/?admin.inc" target="_blank"><button type="button" class="btn btn-mini"><i class="icon icon-external-link"></i> 演示网站</button></a>
<a href="https://www.kancloud.cn/easyimage/easyimage/content" target="_blank"><button type="button" class="btn btn-mini"><i class="icon icon-hand-right"></i> 使用手册</button></a>
<a href="https://t.me/Easy_Image" target="_blank" data-toggle="tooltip" title="EasyImage Telegram Group"><button type="button" class="btn btn-mini"><i class="icon icon-plane"></i> Telegram</button></a>
<a href="../public/images/wechat.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini" style="color:#329d38;"><i class="icon icon-wechat"></i> 打赏作者</a>
<a href="../public/images/alipay.jpg" title="您的赞美是我开发的动力!" data-toggle="lightbox" class="btn btn-mini hidden-xs inline-block" style="color:#1970fc;"><i class="icon icon-zhifubao"></i> 打赏作者</a>
</div>',
'domain'=>'http://127.0.0.1',
'imgurl'=>'http://127.0.0.1',
'user'=>'admin',
'password'=>'e6e061838856bf47e1de730719fb2609',
'captcha'=>0,
'mustLogin'=>0,
'apiStatus'=>1,
'apiStatus'=>0,
'path'=>'/i/',
'mime'=>'image/*,video/*',
'imgName'=>'default',
@ -27,9 +38,9 @@ $config=Array
'waterPosition'=>0,
'textColor'=>'rgba(255,0,0,1)',
'textSize'=>50,
'textFont'=>'/public/static/hkxzy.ttf',
'textFont'=>'/public/static/pang_men_zheng_dao_biao_ti_ti_3.0.ttf',
'waterImg'=>'/public/images/watermark.png',
'extensions'=>'gif,jpeg,png,tif,bmp,tif,svg,webp,jpg,tga,svg,ico',
'extensions'=>'gif,jpeg,png,tif,bmp,tif,svg,webp,jpg,tga,ico',
'compress'=>0,
'compress_ratio'=>80,
'thumbnail'=>1,
@ -60,6 +71,7 @@ $config=Array
'listDate'=>10,
'customize'=>'',
'checkEnv'=>1,
'allowed'=>1,
'upload_logs'=>1,
'cache_freq'=>2,
'upload_first_show'=>1,
@ -98,19 +110,18 @@ $config=Array
'guest_path_status'=>0,
'token_path_status'=>0,
'admin_path'=>'u',
'update'=>'2022-08-13 23:53:14',
'footer'=>'<small>友情链接: </small><a href="https://png.cm/?Links" target="_blank">简单图床</a><br/>
<a href="https://github.com/icret/EasyImages2.0" target="_blank" rel="nofollow" data-toggle="tooltip" title="Since 2018 - Github">© Since 2018</a>
<a href="https://png.cm/" target="_blank" data-toggle="tooltip" title="EasyImage 简单图床">EasyImage</a>
<a href="/admin/terms.php" target="_blank" data-toggle="tooltip" title="使用协议">DMCA</a>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c790ac2bdc2f385757ecd0183206108d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
'update'=>'2022-12-30 02:49:26',
'footer'=>'<a href="https://github.com/icret/EasyImages2.0" target="_blank" rel="nofollow" data-toggle="tooltip" title="Since 2018 - Github">© Since 2018</a>
<a href="https://png.cm/" target="_blank" data-toggle="tooltip" title="EasyImage 简单图床">EasyImage</a>
<a href="/admin/terms.php" target="_blank" data-toggle="tooltip" title="使用协议">DMCA</a>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c790ac2bdc2f385757ecd0183206108d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>',
'ad_top'=>0,
'ad_top_info'=>' <!--广告 按照这个范例替换相应链接,如果想多几个广告,就多复制几个-->

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
/*!
Theme: Default
Description: Original highlight.js style
Author: (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
Maintainer: @highlightjs/core-team
Website: https://highlightjs.org/
License: see project LICENSE
Touched: 2021
*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#f3f3f3;color:#444}.hljs-comment{color:#697070}.hljs-punctuation,.hljs-tag{color:#444a}.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color:#444}.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color:#800}.hljs-section,.hljs-title{color:#800;font-weight:700}.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#ab5656}.hljs-literal{color:#695}.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta .hljs-string{color:#38a}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"appName": "Tiny File Manager",
"version": "2.4.7",
"version": "2.5.0",
"language": [
{
"name": "Română",
@ -323,67 +323,122 @@
"name": "Русский",
"code": "ru",
"translation": {
"Access denied. IP restriction applicable": "Доступ с данного IP запрещён",
"Actions": "Действия",
"AdvancedEditor": "Улучшенный редактор",
"Advanced Search": "Расширенный поиск",
"already exists": "уже существует",
"AppName": "Файловый менеджер",
"AppTitle": "Файловый менеджер",
"Archive": "Архив",
"Archive not created": "Архив не создан",
"Archive not unpacked": "Архив не распакован",
"Archive unpacked": "Архив распакован",
"Back": "Вернуться",
"BackUp": "Резервная копия",
"CalculateFolderSize": "Считать размер папки",
"Cancel": "Отмена",
"Change": "Изменения",
"ChangePermissions": "Изменить права",
"Check Latest Version": "Проверить последнюю версию",
"Copied from": "Скопирован(а)",
"Copy": "Копировать",
"Copying": "Копировать",
"CopyTo": "Скопировать в",
"Create archive?": "Создать архив?",
"Created": "Создан(а)",
"CreateNewItem": "Создать новый",
"CreateNow": "Создать сейчас",
"dark": "тёмная",
"Delete": "Удалить",
"Deleted": "удалён(ена)",
"Delete selected files and folders?": "Удалить выбранные файлы и папки?",
"DestinationFolder": "Папка назначения",
"DirectLink": "Ссылка",
"Download": "Загрузка",
"Edit": "Редактировать",
"ErrorReporting": "Сообщения об ошибках",
"Error while copying from": "Ошибка при копировании",
"Error while deleting items": "Ошибка при удалении элементов",
"Error while fetching archive info": "Ошибка при извлечении информации из архива",
"Error while moving from": "Ошибка при перемещении",
"Error while renaming from": "Ошибка при переименовании",
"Execute": "Исполнение",
"File": "Файл",
"File extension is not allowed": "Запрещённое расширение файла",
"File not found": "Файл не найден",
"File or folder with this path already exists": "Файл или папка с этим путем уже существует",
"File Saved Successfully": "Файл сохранён",
"Files": "Файлы",
"Folder": "Папка",
"Folder is empty": "Папка пуста",
"FreeOf": "свободно из",
"FullSize": "Размер файлов в папке",
"Generate": "Сгенерировать",
"Generate new password hash": "Сгенерировать хеш нового пароля",
"Group": "Группа",
"Help": "Помощь",
"Help Documents": "Справочная документация",
"HideColumns": "Скрыть столбцы права досупа и владелец",
"Invalid characters in file name": "Недопустимые символы в имени файла",
"Invalid characters in file or folder name": "Недопустимые символы в имени файла или папки",
"Invalid file or folder name": "Некорректное имя папки или файла",
"InvertSelection": "Обратная выборка",
"ItemName": "Имя элемента",
"ItemType": "Тип элемента",
"Language": "Язык",
"Login": "Войти",
"Login failed. Invalid username or password": "Не удалось войти. Логин или пароль неверны",
"light": "светлая",
"Logout": "Выйти",
"MemoryUsed": "Используемая память",
"Modified": "Обновление",
"Move": "Переместить",
"Moved from": "перемещён(ена)",
"Name": "Имя",
"NewItem": "Создать",
"NormalEditor": "Стандартный редактор",
"not found!": "не найдено!",
"Nothing selected": "Ничего не выбрано",
"Open": "Открыть",
"Owner": "Создатель",
"Operations with archives are not available": "Операции с архивами недоступны",
"Other": "Другие",
"Owner": "Владелец",
"PartitionSize": "Размер раздела",
"Password": "Пароль",
"password_hash not supported, Upgrade PHP version": "password_hash не поддерживается, обновите версию PHP",
"Paths must be not equal": "Пути должны быть разными",
"Perms": "Права доступа",
"Permissions changed": "Права доступа изменены",
"Permissions not changed": "Права доступа не изменены",
"Preview": "Просмотр",
"Read": "Чтение",
"RememberMe": "Запомнить меня",
"Rename": "Переименовать",
"Renamed from": "Переименован(а)",
"Report Issue": "Сообщить о проблеме",
"Root path": "Путь до корня",
"Save": "Сохранить",
"Saved Successfully": "Сохранено",
"Search": "Поиск",
"SelectAll": "Выбрать всё",
"Selected files and folder deleted": "Выбранные файли и папки удалены",
"Select folder": "Выберите папку",
"Settings": "Свойства",
"ShowHiddenFiles": "Показ скрытых файлов",
"Size": "Размер",
"SourceFolder": "Исходная папка",
"Source path not defined": "Путь к источнику не определён",
"Theme": "Тема",
"to": "в",
"UnSelectAll": "Отменить выбор",
"UnZip": "Разархивировать",
"UnZipToFolder": "Разархивировать в папку",
"Upload": "Загрузить",
"UploadingFiles": "Загрузка файлов",
"Username": "Пользователь"
"Username": "Пользователь",
"Write": "Запись",
"You are logged in": "Вы вошли в систему"
}
},
{
@ -547,7 +602,7 @@
"Copy": "Copiar",
"Save": "Guardar",
"SelectAll": "Seleccionar Todo",
"UnSelectAll": "Des-seleccionar Todo",
"UnSelectAll": "Deseleccionar Todo",
"File": "Archivo",
"Back": "Atrás",
"Size": "Tamaño",