You've already forked EasyImages2.0
mirror of
https://github.com/icret/EasyImages2.0.git
synced 2025-12-13 11:43:58 +08:00
2.7.0 dev
* 2023-01-26 v2.7.0 dev - 增加广场非图片图标 - 替换访问生成缩略图代码 - 更新一些组件 - 优化代码
This commit is contained in:
@@ -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("当前使用局域网,可能会导致外网访问异常!",{
|
||||
|
||||
@@ -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 = '';
|
||||
|
||||
2127
application/class_Zebra_Image.php
Normal file
2127
application/class_Zebra_Image.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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 />';
|
||||
|
||||
@@ -83,8 +83,9 @@ if ($config['notice_status'] == 1 && !empty($config['notice'])) : ?>
|
||||
|
||||
// 二维码对话框属性
|
||||
$('#qr').modal({
|
||||
moveable: true,
|
||||
moveable: "inside",
|
||||
backdrop: false,
|
||||
backdrop: true,
|
||||
show: false,
|
||||
})
|
||||
|
||||
|
||||
@@ -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 文件相对路径
|
||||
|
||||
@@ -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>';
|
||||
@@ -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'],
|
||||
|
||||
@@ -95,7 +95,7 @@ try {
|
||||
html: true,
|
||||
},
|
||||
{
|
||||
label: 'MD5',
|
||||
label: 'FILE-MD5',
|
||||
name: 'md5',
|
||||
html: true,
|
||||
},
|
||||
|
||||
@@ -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'
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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/');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user