2.7.0 dev

* 2023-01-26 v2.7.0 dev
- 增加广场非图片图标
- 替换访问生成缩略图代码
- 更新一些组件
- 优化代码
pull/141/head
icret 2023-01-26 12:32:04 +08:00
parent 9af638a2bd
commit 6409be96fb
31 changed files with 2396 additions and 296 deletions

View File

@ -93,23 +93,71 @@ location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
```
#### API上传
- 需要开启图床安全->API上传示例
<details><summary>通过API上传示例</summary>
- html示例
```html
<form action="http://127.0.0.1/api/index.php" method="post" enctype="multipart/form-data">
<input type="file" name="image" accept="image/*">
<input type="text" name="token" placeholder="在tokenList文件找到token并输入" /> <input type="submit" />
</form>
```
- Python示例
```python
import requests
url = "https://png.cm/api/index.php"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"token\"\r\n\r\n8337effca0ddfcd9c5899f3509b23657\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"\r\n\r\n195124.jpg\r\n-----011000010111000001101001--\r\n\r\n"
headers = {"content-type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
```
- curl示例
```curl
curl --request POST \
--url https://png.cm/api/index.php \
--header 'content-type: multipart/form-data' \
--form token=8337effca0ddfcd9c5899f3509b23657 \
--form image=@195124.jpg
```
- JQuery示例
```jQuery
const form = new FormData();
form.append("token", "8337effca0ddfcd9c5899f3509b23657");
form.append("image", "195124.jpg");
const settings = {
"async": true,
"crossDomain": true,
"url": "https://png.cm/api/index.php",
"method": "POST",
"headers": {},
"processData": false,
"contentType": false,
"mimeType": "multipart/form-data",
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
```
</details>
- 需要开启图床安全->API上传示例
- 上传成功后返回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="
}
{
"result":"success","code":200,
"url":"https:\/\/i2.100024.xyz\/2023\/01\/24\/10gwv0y-0.webp",
"srcName":"195124",
"thumb":"https:\/\/png.cm\/application\/thumb.php?img=\/i\/2023\/01\/24\/10gwv0y-0.webp",
"del":"https:\/\/png.cm\/application\/del.php?hash=bW8vWG4vcG8yM2pLQzRJUGI0dHlTZkN4L2grVmtwUTFhd1A4czJsbHlMST0="
}
```
## 程序升级
@ -183,6 +231,12 @@ $HTTP["url"] =~ "^/(i|public)/" {
<details><summary>点击查看2.0版更新日志</summary>
* 2023-01-26 v2.7.0 dev
- 增加广场非图片图标
- 替换访问生成缩略图代码
- 更新一些组件
- 优化代码
* 2023-01-21 v2.6.9 Happy New Year
- 修复BMP格式无法增加水印(不建议开启,非常耗时)
- 修复上传用户组会串联变成管理员权限 [#61](https://github.com/icret/EasyImages2.0/issues/61)

View File

@ -503,7 +503,7 @@ if (isset($_GET['recycle_reimg'])) {
<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="优点: 缩略图直链 | 缺点: 缓存不失效, 低配vps负载较大,影响前端上传速度"> 访问生成 | 直链</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">

View File

@ -4,6 +4,7 @@ $CONFIG = '{"lang":"zh-CN","error_reporting":false,"show_hidden":true,"hide_Cols
require_once __DIR__ . '/../application/function.php';
// 是否管理员登录
if(!is_who_login('admin')){
require_once APP_ROOT.'/application/header.php';
echo '<div class="alert alert-danger">还没有登陆哦~~</div>';

View File

@ -1 +1 @@
2.6.9
2.7.0 dev

View File

@ -1 +0,0 @@
2.6.8

View File

@ -57,7 +57,7 @@ if ($handle->uploaded) {
// 最小高度
$handle->image_min_height = $config['minHeight'];
// 2023-01-06 转换图片为指定格式 只转换非webp格式和非动态图片
if ($handle->file_src_name_ext !== 'webp' && !isAnimatedGif($handle->file_src_pathname)) {
if ($handle->file_src_name_ext !== 'webp' && !isGifAnimated($handle->file_src_pathname)) {
$handle->image_convert = $config['imgConvert'];
}
// 2023-01-06 PNG 图像的压缩级别,介于 1快速但大文件和 9慢但较小文件之间
@ -129,23 +129,15 @@ if ($handle->uploaded) {
$delUrl = "Admin closed user delete";
}
// 当设置访问生成缩略图时自动生成 2022-12-30
// 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-24
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_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/');
}

View File

@ -1,4 +1,16 @@
<?php
// 检查当前PHP版本是否大于7.0
if (PHP_VERSION < 7) {
echo '
<script>
new $.zui.Messager("当前PHP版本<7.0, 部分功能受限!",{
type: "primary", // 定义颜色主题
time:7000
}).show();
</script>
';
}
// 扩展检测
$expand = array('fileinfo', 'iconv', 'gd', 'mbstring', 'openssl',);
foreach ($expand as $val) {
@ -26,21 +38,8 @@ if ($config['password'] === 'e6e061838856bf47e1de730719fb2609') {
';
}
/*
// 检测是否更改默认域名
if (strstr('localhost|127.0.0.1|192.168.', $_SERVER['HTTP_HOST'])) {
echo '
<script>
new $.zui.Messager("请修改默认域名,可能会导致网站访问异常! ",{
type: "black" // 定义颜色主题
}).show();
</script>
';
}
*/
// 检测是否局域网访问
if (is_local($config['domain'])) {
if (is_local($config['domain']) || is_local($config['imgurl'])) {
echo '
<script>
new $.zui.Messager("当前使用局域网,可能会导致外网访问异常!",{

View File

@ -2030,6 +2030,7 @@ class Upload {
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'mp3' => 'audio/mpeg3',
'mp4' => 'video/mp4',
'wav' => 'audio/wav',
'aiff' => 'audio/aiff',
'aif' => 'audio/aiff',
@ -2117,7 +2118,7 @@ class Upload {
*/
function upload($file, $lang = 'en_GB') {
$this->version = '30/08/2022';
$this->version = '09/12/2022';
$this->file_src_name = '';
$this->file_src_name_body = '';

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ function compress($floder, $type = 'Imgcompress', $source = '')
foreach ($pic as $value) {
$boxImg = $floder . $value;
// 跳过动态图片
if (!isAnimatedGif($boxImg)) {
if (!isGifAnimated($boxImg)) {
$img = new Imgcompress($boxImg, $percent);
$img->compressImg($boxImg);
echo '<pre>' . $boxImg . '</pre><br />';

View File

@ -83,8 +83,9 @@ if ($config['notice_status'] == 1 && !empty($config['notice'])) : ?>
// 二维码对话框属性
$('#qr').modal({
moveable: true,
moveable: "inside",
backdrop: false,
backdrop: true,
show: false,
})

View File

@ -44,7 +44,7 @@ require_once APP_ROOT . '/config/config.guest.php';
* @param $filename string 文件
* @return int |
*/
function isAnimatedGif($filename)
function isGifAnimated($filename)
{
$fp = fopen($filename, 'rb');
$filecontent = fread($fp, filesize($filename));
@ -52,6 +52,61 @@ function isAnimatedGif($filename)
return strpos($filecontent, chr(0x21) . chr(0xff) . chr(0x0b) . 'NETSCAPE2.0') === FALSE ? 0 : 1;
}
/**
* 判断webp是否为动态图片
* @param string $src 图像文件
* @return bool |
*/
function isWebpAnimated($src)
{
$webpFile = file_get_contents($src);
$info = strpos($webpFile, "ANMF");
if ($info !== FALSE) {
// animated
return true;
}
// not animated
return false;
/* 2023-01-24 判断webp是否为动画
$result = false;
$fh = fopen($src, "rb");
fseek($fh, 12);
if (fread($fh, 4) === 'VP8X') {
fseek($fh, 16);
$myByte = fread($fh, 1);
$result = ((ord($myByte) >> 1) & 1) ? true : false;
}
fclose($fh);
return $result;
*/
}
/**
* 判断webp或gif动图是否为动态图片
* @param $src 图片的绝对路径
* @return bool |
*/
function is_Gif_Webp_Animated($src)
{
$ext = pathinfo($src)['extension'];
if ($ext == 'webp') {
$webpContents = file_get_contents($src);
$where = strpos($webpContents, "ANMF");
if ($where !== FALSE) {
// animated
return true;
}
return false;
}
$fp = fopen($src, 'rb');
$filecontent = fread($fp, filesize($src));
fclose($fp);
return strpos($filecontent, chr(0x21) . chr(0xff) . chr(0x0b) . 'NETSCAPE2.0') === FALSE ? false : true;
}
/**
* 2023-01-06 校验登录
@ -1038,21 +1093,12 @@ function creat_thumbnail_images($imgName)
$old_img_path = APP_ROOT . config_path() . $imgName; // 获取要创建缩略图文件的绝对路径
$cache_path = APP_ROOT . $config['path'] . 'thumbnails/'; // cache目录的绝对路径
// 自定义缩略图长宽
$thumbnail_w = 258;
$thumbnail_h = 258;
if (!empty($config['thumbnail_w']) || !empty($config['thumbnail_h'])) {
$thumbnail_w = $config['thumbnail_w'];
$thumbnail_h = $config['thumbnail_h'];
}
if (!is_dir($cache_path)) { // 创建cache目录
mkdir($cache_path, 0777, true);
}
if (!isAnimatedGif($old_img_path)) { // 仅针对非gif创建图片缩略图
if (!isGifAnimated($old_img_path)) { // 仅针对非gif创建图片缩略图
$new_imgName = APP_ROOT . $config['path'] . 'thumbnails/' . date('Y_m_d') . '_' . $imgName; // 缩略图缓存的绝对路径
Thumb::out($old_img_path, $new_imgName, $thumbnail_w, $thumbnail_h); // 保存缩略图
Thumb::out($old_img_path, $new_imgName, $config['thumbnail_w'], $config['thumbnail_h']); // 保存缩略图
}
}
@ -1066,7 +1112,7 @@ function return_thumbnail_images($url)
global $config;
$cache_image_file = str_replace($config['imgurl'], '', $url);
if (isAnimatedGif(APP_ROOT . $cache_image_file)) { // 仅读取非gif的缩略图
if (isGifAnimated(APP_ROOT . $cache_image_file)) { // 仅读取非gif的缩略图
return $url; // 如果是gif则直接返回url
} else {
$cache_image_file = str_replace($config['path'], '', $cache_image_file); // 将网址中的/i/去除
@ -1105,6 +1151,16 @@ function creat_thumbnail_by_list($imgUrl)
{
global $config;
// 过滤非指定格式
if (!in_array(pathinfo($imgUrl, PATHINFO_EXTENSION), array('png', 'gif', 'jpeg', 'jpg', 'webp', 'bmp'))) {
// ico格式直接返回直链
if (pathinfo($imgUrl, PATHINFO_EXTENSION) === 'ico') return $imgUrl;
// 其他格式直接返回指定图标
return '/../public/images/file_10_icon-icons.com_68948.svg';
}
ini_set('max_execution_time', '300'); // 脚本运行的时间以秒为单位0不限制
switch ($config['thumbnail']) {
@ -1120,16 +1176,12 @@ function creat_thumbnail_by_list($imgUrl)
// 将网址图片转换为相对路径
$pathName = str_replace($config['domain'], '', $imgUrl);
// 图片绝对路径
$abPathName = APP_ROOT . $pathName;
// 将网址中的/i/去除
$pathName = str_replace($config['path'], '', $pathName);
// 将文件的/转换为_
$imgName = str_replace('/', '_', $pathName);
// 缓存文件是否存在
if (is_file(APP_ROOT . $config['path'] . 'thumbnails/' . $imgName)) {
// 存在则返回缓存文件
@ -1137,46 +1189,35 @@ function creat_thumbnail_by_list($imgUrl)
} else {
// 如果图像是gif则直接返回网址
if (isAnimatedGif($abPathName)) {
if (isGifAnimated($abPathName)) {
return $imgUrl;
}
// 如果是webp动图则直接返回网址
if (isWebpAnimated($abPathName)) {
return $imgUrl;
}
// 过滤非指定格式
if (!in_array(pathinfo(basename($abPathName), PATHINFO_EXTENSION), array('png', 'gif', 'jpeg', 'jpg', 'webp', 'bmp', 'ico'))) {
return $imgUrl;
}
// 创建缓存文件并输出文件链接
require_once __DIR__ . '/class.thumb.php';
/** 创建缓存文件并输出文件链接 */
// thumbnails目录的绝对路径
$cache_path = APP_ROOT . $config['path'] . 'thumbnails/';
// 创建cache目录
if (!is_dir($cache_path)) {
mkdir($cache_path, 0777, true);
}
// 自定义缩略图长宽
$thumbnail_w = 258;
$thumbnail_h = 258;
if (!empty($config['thumbnail_w']) || !empty($config['thumbnail_h'])) {
$thumbnail_w = $config['thumbnail_w'];
$thumbnail_h = $config['thumbnail_h'];
}
// 缩略图缓存的绝对路径
// $imgName 是不带/i/的相对路径
// 缩略图缓存的绝对路径 $imgName 是不带/i/的相对路径
$new_imgName = $cache_path . $imgName;
// 创建并保存缩略图
Thumb::out($abPathName, $new_imgName, $thumbnail_w, $thumbnail_h);
if ($config['thumbnail'] == 2) {
require_once __DIR__ . '/class_Zebra_Image.php';
$image = new Zebra_Image();
$image->source_path = $abPathName;
$image->target_path = $new_imgName;
$image->resize($config['thumbnail_w'], $config['thumbnail_h'], ZEBRA_IMAGE_CROP_CENTER);
} else {
require_once __DIR__ . '/class.thumb.php';
Thumb::out($abPathName, $new_imgName, $config['thumbnail_w'], $config['thumbnail_h']);
}
// 输出缩略图
return $new_imgName;
@ -1431,24 +1472,6 @@ function check_api($token)
}
}
/**
* 判断webp是否为动态图片
* @param string $src 图像文件
* @return bool |
*/
function isWebpAnimated($src)
{
$webpContents = file_get_contents($src);
$where = strpos($webpContents, "ANMF");
if ($where !== FALSE) {
// animated
$isAnimated = true;
} else {
// not animated
$isAnimated = false;
}
return $isAnimated;
}
/**
* 根据URL判断是否本地局域网访问(PHP代码函数)
@ -1477,31 +1500,6 @@ function rand_imgurl($text = null)
return $url[array_rand($url, 1)];
}
/**
* 判断webp或gif动图是否为动态图片
* @param $src 图片的绝对路径
* @return bool |
*/
function isAnimatedGifWebp($src)
{
$ext = pathinfo($src)['extension'];
if ($ext == 'webp') {
$webpContents = file_get_contents($src);
$where = strpos($webpContents, "ANMF");
if ($where !== FALSE) {
// animated
return true;
}
return false;
}
$fp = fopen($src, 'rb');
$filecontent = fread($fp, filesize($src));
fclose($fp);
return strpos($filecontent, chr(0x21) . chr(0xff) . chr(0x0b) . 'NETSCAPE2.0') === FALSE ? false : true;
}
/**
* 获取当前版本号
* @param String $file 文件相对路径

View File

@ -1,84 +0,0 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_CN.php |
// +------------------------------------------------------------------------+
// | Copyright (c) caoshiwei 2008. All rights reserved. |
// | Version 0.25 |
// | Last modified 09/29/2008 |
// | Email caoshiwei@gmail.com |
// | Web http://www.hfut.edu.cn |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Chinese translation
*
* @version 0.25
* @codepage gb-2312
* @author Shiwei Cao (caoshiwei@gmail.com)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Shiwei Cao
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD>';
$translation['local_file_missing'] = '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>';
$translation['local_file_not_readable'] = '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɶ<EFBFBD><C9B6>';
$translation['uploaded_too_big_ini'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (<28>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>php.ini<6E><69>upload_max_filesize<7A><65><EFBFBD>õĴ<C3B5>С)<29><>';
$translation['uploaded_too_big_html'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (<28>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HTML <20><><EFBFBD><EFBFBD><EFBFBD>õĴ<C3B5>С)<29><>';
$translation['uploaded_partial'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (<28>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ֶ<EFBFBD>ʧ)<29><>';
$translation['uploaded_missing'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (<28>ϴ<EFBFBD><CFB4>ļ<EFBFBD><C4BC><EFBFBD>ʧ)<29><>';
$translation['uploaded_unknown'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> (δ֪<CEB4><D6AA><EFBFBD><EFBFBD>).';
$translation['try_again'] = '<27>ļ<EFBFBD><C4BC>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD>';
$translation['file_too_big'] = '<27>ļ<EFBFBD>̫<EFBFBD><CCAB><EFBFBD><EFBFBD>';
$translation['no_mime'] = 'δ֪<CEB4>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>͡<EFBFBD>';
$translation['incorrect_file'] = '<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʽ<EFBFBD><CABD>';
$translation['image_too_wide'] = 'ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>̫<EFBFBD><CCAB><EFBFBD><EFBFBD>';
$translation['image_too_narrow'] = 'ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>̫С<CCAB><D0A1>';
$translation['image_too_high'] = 'ͼƬ<CDBC>߶<EFBFBD>̫<EFBFBD><CCAB><EFBFBD><EFBFBD>';
$translation['image_too_short'] = 'ͼƬ<CDBC>߶<EFBFBD>̫С<CCAB><D0A1>';
$translation['ratio_too_high'] = 'ͼƬ<CDBC><C6AC>/<2F>߱<EFBFBD><DFB1><EFBFBD>̫<EFBFBD><CCAB>(ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>̫<EFBFBD><CCAB>)<29><>';
$translation['ratio_too_low'] = 'ͼƬ<CDBC><C6AC>/<2F>߱<EFBFBD><DFB1><EFBFBD>̫<EFBFBD><CCAB>(ͼƬ<CDBC>߶<EFBFBD>̫<EFBFBD><CCAB>).';
$translation['too_many_pixels'] = 'ͼƬλ<C6AC><CEBB>̫<EFBFBD>ߡ<EFBFBD>';
$translation['not_enough_pixels'] = 'ͼƬλ<C6AC><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
$translation['file_not_uploaded'] = '<27>ļ<EFBFBD>δ<EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['already_exists'] = '%s <20>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>';
$translation['temp_file_missing'] = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>ʱ)Դ<>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['source_missing'] = '<27><><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_dir'] = 'Ŀ<><C4BF><EFBFBD>ļ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_dir_missing'] = 'Ŀ<><C4BF><EFBFBD>ļ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_path_not_dir'] = 'Ŀ¼·<C2BC><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_dir_write'] = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ļ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['destination_path_write'] = 'Ŀ¼·<C2BC><C2B7><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['temp_file'] = '<27><><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['source_not_readable'] = <>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>д<EFBFBD><D0B4><EFBFBD>';
$translation['no_create_support'] = '%s <20><>֧<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>';
$translation['create_error'] = '<27><>Դ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> %s ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD>';
$translation['source_invalid'] = '<27>޷<EFBFBD><DEB7><EFBFBD>ȡԭʼͼƬ<CDBC><C6AC>ȷ<EFBFBD><C8B7><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ͼƬ<CDBC>ļ<EFBFBD><C4BC><EFBFBD>';
$translation['gd_missing'] = 'GD <20><><EFBFBD>񲻿<EFBFBD><F1B2BBBF><EFBFBD>ʹ<EFBFBD>á<EFBFBD>';
$translation['watermark_no_create_support'] = '%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>, <20><><EFBFBD>ܶ<EFBFBD>ȡˮӡ<CBAE>ļ<EFBFBD><C4BC><EFBFBD>';
$translation['watermark_create_error'] = '%s <20><>֧<EFBFBD>ֶ<EFBFBD>, <20><><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>ˮӡ<CBAE><D3A1>';
$translation['watermark_invalid'] = 'δ֪<CEB4>ļ<EFBFBD><C4BC><EFBFBD>ʽ, <20>޷<EFBFBD><DEB7><EFBFBD>ȡˮӡ<CBAE>ļ<EFBFBD><C4BC><EFBFBD>';
$translation['file_create'] = '%s <20><>֧<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>';
$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

@ -9,7 +9,7 @@ function compress($absolutePath)
global $config;
// 压缩图片 后压缩模式,不影响前台输出速度
if ($config['compress']) {
if (!isAnimatedGif($absolutePath)) {
if (!is_Gif_Webp_Animated($absolutePath)) {
require_once __DIR__ . '/compress/Imagick/class.Imgcompress.php';
$percent = $config['compress_ratio'] / 100; // 压缩率
$img = new Imgcompress($absolutePath, $percent);
@ -29,7 +29,7 @@ function water($source)
// 文字水印
if ($config['watermark'] == 1) {
// 过滤gif
if (!isAnimatedGifWebp($source)) {
if (!is_Gif_Webp_Animated($source)) {
$arr = [
# 水印图片路径(如果不存在将会被当成是字符串水印)
'res' => $config['waterText'],
@ -48,7 +48,7 @@ function water($source)
// 图片水印
if ($config['watermark'] == 2) {
// 过滤gif
if (!isAnimatedGifWebp($source)) {
if (!is_Gif_Webp_Animated($source)) {
$arr = [
# 水印图片路径(如果不存在将会被当成是字符串水印)
'res' => APP_ROOT . $config['waterImg'],

View File

@ -95,7 +95,7 @@ try {
html: true,
},
{
label: 'MD5',
label: 'FILE-MD5',
name: 'md5',
html: true,
},

View File

@ -46,28 +46,20 @@ Thumb::show($src, $w, $h);
require_once __DIR__ . '/function.php';
// 自定义缩略图长宽
$thumbnail_w = 258;
$thumbnail_h = 258;
if (!empty($config['thumbnail_w']) || !empty($config['thumbnail_h'])) {
$thumbnail_w = $config['thumbnail_w'];
$thumbnail_h = $config['thumbnail_h'];
}
// 缓存时间
$cache_freq = $config['cache_freq'] * 60 * 60;
// 中文翻译 https://my.oschina.net/whrlmc/blog/81739
define('LOCAL_FILE_BASE_DIRECTORY', APP_ROOT);
define('MEMORY_LIMIT', '256M');
define('DEFAULT_WIDTH', $thumbnail_w);
define('DEFAULT_HEIGHT', $thumbnail_h);
define('DEFAULT_WIDTH', $config['thumbnail_w']);
define('DEFAULT_HEIGHT', $config['thumbnail_h']);
define('FILE_CACHE_PREFIX', 'EasyImage');
define('DEFAULT_ZC', 0);
define('MAX_WIDTH', 10240);
define('MAX_HEIGHT', 10240);
define('FILE_CACHE_DIRECTORY', APP_ROOT . $config['path'] . 'thumbnails');
define('FILE_CACHE_DIRECTORY', APP_ROOT . $config['path'] . 'thumbnails/');
define('NOT_FOUND_IMAGE', $config['domain'] . '/public/images/404.png');
define('ERROR_IMAGE', $config['domain'] . '/public/images/404.png');
define('DISPLAY_ERROR_MESSAGES', false);
@ -80,18 +72,6 @@ global $ALLOWED_SITES;
$ALLOWED_SITES = array(
$config['domain'],
$config['imgurl'],
'flickr.com',
'staticflickr.com',
'picasa.com',
'img.youtube.com',
'upload.wikimedia.org',
'photobucket.com',
'imgur.com',
'imageshack.us',
'tinypic.com',
'mind.sh',
'mindsharelabs.com',
'mindsharestudios.com'
);
/**

View File

@ -61,7 +61,7 @@ if ($handle->uploaded) {
// 最小高度
$handle->image_min_height = $config['minHeight'];
// 2023-01-06 转换图片为指定格式 只转换非webp格式和非动态图片
if ($handle->file_src_name_ext !== 'webp' && !isAnimatedGif($handle->file_src_pathname)) {
if ($handle->file_src_name_ext !== 'webp' && !isGifAnimated($handle->file_src_pathname)) {
$handle->image_convert = $config['imgConvert'];
}
// 2023-01-06 PNG 图像的压缩级别,介于 1快速但大文件和 9慢但较小文件之间
@ -149,23 +149,15 @@ if ($handle->uploaded) {
$delUrl = "Admin closed user delete";
}
// 当设置访问生成缩略图时自动生成 2022-12-30
// 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-24
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_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/');
}

File diff suppressed because one or more lines are too long

View File

@ -41,7 +41,8 @@ mustLogin();
<li <?php if ($config['upload_first_show'] == 4) echo 'class="active"'; ?>>
<a href="#" data-target="#tab2Content4" data-toggle="tab"><i class="icon icon-html5"></i> HTML</a>
</li>
<li <?php if ($config['upload_first_show'] == 5) echo 'class="active"'; ?>>
<li <?php if ($config['upload_first_show'] == 5) echo 'class="active"';
if ($config['show_user_hash_del'] == 0) echo 'style="display:none;"' ?>>
<a href="#" data-target="#tab2Content5" data-toggle="tab"><i class="icon icon-trash"></i> 删除</a>
</li>
</ul>
@ -149,6 +150,11 @@ mustLogin();
document.getElementById("markdown").innerHTML += "![" + obj.srcName + "](" + obj.url + ")\r\n";
document.getElementById("html").innerHTML += '<img src="' + obj.url + '" alt="' + obj.srcName + '" />\r\n';
document.getElementById("del").innerHTML += obj.del + "\r\n";
new $.zui.Messager(obj.srcName + "上传成功", {
type: "primary", // 定义颜色主题
placement: 'bottom-right',
icon: "check" // 定义消息图标
}).show();
} else {
return '上传失败,错误信息:' + obj.message;
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" ?><svg style="enable-background:new 0 0 128 128;" version="1.1" viewBox="0 0 128 128" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><style type="text/css">
.st0{fill:#00B8DF;}
.st1{fill:#FF9A30;}
.st2{fill:#FFFFFF;}
.st3{fill:#61BEE2;}
.st4{fill:#FD4233;}
.st5{fill:#FF402F;}
.st6{fill:#1D409D;}
.st7{fill:#007732;}
.st8{fill:#FF5A29;}
</style><g/><g id="Ps"/><g id="Ai"/><g id="Ai_download"/><g id="Image"/><g id="Image_download"/><g id="Video"/><g id="Video_download"/><g id="Ps_download"/><g id="Doc"/><g id="Doc_download"/><g id="Music"/><g id="Music_download"/><g id="Pdf"/><g id="Pdf_download"/><g id="Word"/><g id="Word_download"/><g id="Exel"><g><g><path class="st7" d="M80,96h-8.3l-8-13l-8,13H48l11.4-17.7L48.7,61.7h8l7.4,12.3l7.2-12.3h7.8l-10.8,17L80,96z"/></g><g><path class="st7" d="M104,126H24c-5.5,0-10-4.5-10-10V12c0-5.5,4.5-10,10-10h40.7c2.7,0,5.2,1,7.1,2.9l39.3,39.3 c1.9,1.9,2.9,4.4,2.9,7.1V116C114,121.5,109.5,126,104,126z M24,6c-3.3,0-6,2.7-6,6v104c0,3.3,2.7,6,6,6h80c3.3,0,6-2.7,6-6V51.3 c0-1.6-0.6-3.1-1.8-4.2L68.9,7.8C67.8,6.6,66.3,6,64.7,6H24z"/></g></g></g><g id="Exel_download"/><g id="Powerpoint"/><g id="Powerpoint_download"/><g id="Zip"/><g id="Zip_download"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* ZUI: Standard edition - v1.10.0 - 2022-05-20
* ZUI: Standard edition - v1.10.0 - 2022-08-23
* http://openzui.com
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2022 cnezsoft.com; Licensed MIT

File diff suppressed because one or more lines are too long

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,5 +1,5 @@
/*!
* ZUI: - v1.10.0 - 2022-05-20
* ZUI: - v1.10.0 - 2022-08-23
* http://openzui.com
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2022 cnezsoft.com; Licensed MIT

View File

@ -1,5 +1,5 @@
/*!
* ZUI: 文件上传 - v1.10.0 - 2022-05-20
* ZUI: 文件上传 - v1.10.0 - 2022-08-23
* http://openzui.com
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2022 cnezsoft.com; Licensed MIT