* 2023-01-30 v2.7.0 dev

- 增加粘贴上传状态
- 增加前端显示缩略图链接
- 增加图片详细信息登录后显示更多信息
- 修复图片详细信息中随机图片排版混乱
pull/141/head
icret 2023-01-30 06:15:24 +08:00
parent 6409be96fb
commit 665bdf7d65
19 changed files with 312 additions and 215 deletions

View File

@ -231,8 +231,12 @@ $HTTP["url"] =~ "^/(i|public)/" {
<details><summary>点击查看2.0版更新日志</summary>
* 2023-01-26 v2.7.0 dev
* 2023-01-30 v2.7.0 dev
- 增加粘贴上传状态
- 增加广场非图片图标
- 增加前端显示缩略图链接
- 增加图片详细信息登录后显示更多信息
- 修复图片详细信息中随机图片排版混乱
- 替换访问生成缩略图代码
- 更新一些组件
- 优化代码

View File

@ -853,7 +853,7 @@ if (isset($_GET['recycle_reimg'])) {
<h5>上传后首选显示</h5>
<label class="radio-inline">
<input type="radio" name="upload_first_show" value="1" data-toggle="tooltip" title="图片直链" <?php if ($config['upload_first_show'] == 1) echo 'checked'; ?>>
<i class="icon icon-link"></i>
<i class="icon icon-picture"></i>
</label>
<label class="radio-inline">
<input type="radio" name="upload_first_show" value="2" data-toggle="tooltip" title="论坛代码" <?php if ($config['upload_first_show'] == 2) echo 'checked'; ?>>
@ -867,8 +867,12 @@ if (isset($_GET['recycle_reimg'])) {
<input type="radio" name="upload_first_show" value="4" data-toggle="tooltip" title="HTML" <?php if ($config['upload_first_show'] == 4) echo 'checked'; ?>>
<i class="icon icon-html5"></i>
</label>
<label class="radio-inline">
<input type="radio" name="upload_first_show" value="5" data-toggle="tooltip" title="缩略图" <?php if ($config['upload_first_show'] == 5) echo 'checked'; ?>>
<i class="icon icon-camera"></i>
</label>
<label class="radio-inline" data-toggle="tooltip" title="删除链接">
<input <?php if ($config['show_user_hash_del'] == 0) echo 'disabled'; ?> type="radio" id="upload_first_show5" name="upload_first_show" value="5" <?php if ($config['upload_first_show'] == 5) echo 'checked'; ?>>
<input <?php if ($config['show_user_hash_del'] == 0) echo 'disabled'; ?> type="radio" name="upload_first_show" value="6" <?php if ($config['upload_first_show'] == 6) echo 'checked'; ?>>
<i class="icon icon-trash"></i>
</label>
</div>
@ -1179,9 +1183,9 @@ if (isset($_GET['recycle_reimg'])) {
<div class="tab-pane fade" id="Content14">
<h5 class="header-dividing">文件管理 <small>由作者定制,非必要请勿替换</small></h5>
<a class="btn btn-mini btn-primary" href="/admin/manager.php?p=<?php echo date('Y/m/d'); ?> " target="_blank" data-toggle="tooltip" title="使用Tinyfilemanager管理文件"><i class="icon icon-folder-open"> 文件管理</i></a>
<h5 class="header-dividing">清理缓存 <small>已缓存: <?php echo getFileNumber(APP_ROOT . $config['path'] . 'thumbnails/') . '文件 | 占用' . getDistUsed(getDirectorySize(APP_ROOT . $config['path'] . 'thumbnails/')); ?></small></h5>
<h5 class="header-dividing">清理缓存 <small>已缓存: <?php echo getFileNumber(APP_ROOT . $config['path'] . 'cache/') . '文件 | 占用' . getDistUsed(getDirectorySize(APP_ROOT . $config['path'] . 'cache/')); ?></small></h5>
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<button type="submit" class="btn btn-mini btn-success" name="delDir" value="thumbnails/" onClick="return confirm('确认要清理缓存?\n* 删除文件夹后将无法恢复! ');"><i class="icon icon-trash"> 清理缓存</i></button>
<button type="submit" class="btn btn-mini btn-success" name="delDir" value="cache/" onClick="return confirm('确认要清理缓存?\n* 删除文件夹后将无法恢复! ');"><i class="icon icon-trash"> 清理缓存</i></button>
</form>
<h5 class="header-dividing">删除文件 <small>* 删除后不可恢复</small></h5>
<form class="form-inline" method="get" action="../application/del.php" id="form" name="delForm" target="_blank" style="margin-bottom: 5px;">

View File

@ -92,7 +92,7 @@ if (is_array($char_data)) {
<div class="col-xs-3 alert alert-primary autoshadow">
缓存文件
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'thumbnails/')); ?>
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'cache/')); ?>
</div>
<div class="col-xs-3 alert alert-primary autoshadow">
可疑图片

View File

@ -1 +1 @@
2.7.0 dev
2.6.9

View File

@ -85,7 +85,7 @@ if (is_array($char_data)) {
<div class="col-xs-3 alert alert-primary autoshadow">
缓存文件
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'thumbnails/')); ?>
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'cache/')); ?>
</div>
<div class="col-xs-3 alert alert-primary autoshadow">
可疑图片

View File

@ -129,7 +129,8 @@ if ($handle->uploaded) {
$delUrl = "Admin closed user delete";
}
// 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-24
// 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-30
$handleThumb = $config['domain'] . '/application/thumb.php?img=' . $pathIMG;
if ($config['thumbnail'] == 2) {
// 自定义缩略图长宽
$handle->image_resize = true;
@ -138,7 +139,8 @@ if ($handle->uploaded) {
// 如果调整后的图像大于原始图像,则取消调整大小,以防止放大
$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/');
$handle->process(APP_ROOT . $config['path'] . 'cache/');
$handleThumb = $config['domain'] . $config['path'] . 'cache/' . $handle->file_dst_name;
}
// 上传成功后返回json数据
@ -147,7 +149,7 @@ if ($handle->uploaded) {
"code" => 200,
"url" => $imageUrl,
"srcName" => $handle->file_src_name_body,
"thumb" => $config['domain'] . '/application/thumb.php?img=' . $pathIMG,
"thumb" => $handleThumb,
"del" => $delUrl,
);
echo json_encode($reJson, JSON_UNESCAPED_UNICODE);

View File

@ -565,7 +565,7 @@ function getFile($dir)
* 获取文件夹文件列表或数量
* @param string $dir_fileName_suffix 获取文件列表:目录+文件名*:全匹配+文件后缀 *: 全匹配 {jpg,png,gif}:匹配指定格式
* 递归文件数量:目录
* @example get_file_by_glob(__DIR__ . '/i/thumbnails/*.*', $type = 'list'); // 获取目录文件列表
* @example get_file_by_glob(__DIR__ . '/i/cache/*.*', $type = 'list'); // 获取目录文件列表
* @example get_file_by_glob(__DIR__ . '/i/', $type = 'number'); // 递归获取文件夹数量
* @param string $type list|number 返回列表还是数量
* @return array|int 返回数组|数量
@ -1091,13 +1091,13 @@ function creat_thumbnail_images($imgName)
global $config;
$old_img_path = APP_ROOT . config_path() . $imgName; // 获取要创建缩略图文件的绝对路径
$cache_path = APP_ROOT . $config['path'] . 'thumbnails/'; // cache目录的绝对路径
$cache_path = APP_ROOT . $config['path'] . 'cache/'; // cache目录的绝对路径
if (!is_dir($cache_path)) { // 创建cache目录
mkdir($cache_path, 0777, true);
}
if (!isGifAnimated($old_img_path)) { // 仅针对非gif创建图片缩略图
$new_imgName = APP_ROOT . $config['path'] . 'thumbnails/' . date('Y_m_d') . '_' . $imgName; // 缩略图缓存的绝对路径
$new_imgName = APP_ROOT . $config['path'] . 'cache/' . date('Y_m_d') . '_' . $imgName; // 缩略图缓存的绝对路径
Thumb::out($old_img_path, $new_imgName, $config['thumbnail_w'], $config['thumbnail_h']); // 保存缩略图
}
}
@ -1117,9 +1117,9 @@ function return_thumbnail_images($url)
} else {
$cache_image_file = str_replace($config['path'], '', $cache_image_file); // 将网址中的/i/去除
$cache_image_file = str_replace('/', '_', $cache_image_file); // 将文件的/转换为_
$isFile = APP_ROOT . $config['path'] . 'thumbnails/' . $cache_image_file; // 缓存文件的绝对路径
$isFile = APP_ROOT . $config['path'] . 'cache/' . $cache_image_file; // 缓存文件的绝对路径
if (file_exists($isFile)) { // 缓存文件是否存在
return $config['imgurl'] . $config['path'] . 'thumbnails/' . $cache_image_file; // 存在则返回缓存文件
return $config['imgurl'] . $config['path'] . 'cache/' . $cache_image_file; // 存在则返回缓存文件
} else {
return $url; // 不存在直接返回url
}
@ -1149,20 +1149,18 @@ function get_online_thumbnail($imgUrl)
*/
function creat_thumbnail_by_list($imgUrl)
{
global $config;
ini_set('max_execution_time', '300'); // 脚本运行的时间以秒为单位0不限制
// 过滤非指定格式
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';
return '../public/images/file.svg';
}
ini_set('max_execution_time', '300'); // 脚本运行的时间以秒为单位0不限制
switch ($config['thumbnail']) {
// 输出原图
case 0:
@ -1175,17 +1173,18 @@ function creat_thumbnail_by_list($imgUrl)
}
// 将网址图片转换为相对路径
$pathName = str_replace($config['domain'], '', $imgUrl);
$pathName = parse_url($imgUrl,PHP_URL_PATH);
// 图片绝对路径
$abPathName = APP_ROOT . $pathName;
// 将网址中的/i/去除
$pathName = str_replace($config['path'], '', $pathName);
// 将文件的/转换为_
$imgName = str_replace('/', '_', $pathName);
$thumbnail = str_replace('/', '_', $pathName);
// 缓存文件是否存在
if (is_file(APP_ROOT . $config['path'] . 'thumbnails/' . $imgName)) {
if (is_file(APP_ROOT . $config['path'] . 'cache/' . $thumbnail)) {
// 存在则返回缓存文件
return $config['domain'] . $config['path'] . 'thumbnails/' . $imgName;
return $config['domain'] . $config['path'] . 'cache/' . $thumbnail;
} else {
// 如果图像是gif则直接返回网址
@ -1200,16 +1199,16 @@ function creat_thumbnail_by_list($imgUrl)
/** 创建缓存文件并输出文件链接 */
// thumbnails目录的绝对路径
$cache_path = APP_ROOT . $config['path'] . 'thumbnails/';
$cache_path = APP_ROOT . $config['path'] . 'cache/';
// 创建cache目录
if (!is_dir($cache_path)) {
mkdir($cache_path, 0777, true);
mkdir($cache_path, 0755, true);
}
// 缩略图缓存的绝对路径 $imgName 是不带/i/的相对路径
$new_imgName = $cache_path . $imgName;
$new_imgName = $cache_path . $thumbnail;
// 创建并保存缩略图
if ($config['thumbnail'] == 2) {
require_once __DIR__ . '/class_Zebra_Image.php';
require_once __DIR__ . '/Zebra_Image.php';
$image = new Zebra_Image();
$image->source_path = $abPathName;
$image->target_path = $new_imgName;

View File

@ -17,9 +17,23 @@ if (isset($_GET['img'])) {
// 开启隐藏上传目录
if ($config['hide_path']) {
$img_url = rand_imgurl() . str_replace($config['path'], '/', $getIMG);
// 获取当前图片日志文件
$logs = str_replace('/', '-', substr(parse_url($img_url, PHP_URL_PATH), 1, 7));
} else {
// 关闭隐藏上传目录
$img_url = rand_imgurl() . $getIMG;
// 获取当前图片日志文件
$logs = str_replace('/', '-', substr(str_replace($config['path'], '', parse_url($img_url, PHP_URL_PATH)), 0, 7));
}
// 导入日志文件
$logsName = basename($img_url);
if (is_file(APP_ROOT . '/admin/logs/upload/' . $logs . '.php')) {
include APP_ROOT . '/admin/logs/upload/' . $logs . '.php';
} else {
$logs = array($logsName => array('source' => '日志文件不存在', 'date' => '日志文件不存在', 'ip' => '日志文件不存在', 'port' => '日志文件不存在', 'user_agent' => '日志文件不存在', 'path' => '日志文件不存在', 'size' => '日志文件不存在', 'md5' => '日志文件不存在', 'checkImg' => '日志文件不存在', 'from' => '日志文件不存在'));
}
// 图片真实路径
@ -37,11 +51,10 @@ $imgSize = filesize($imgABPath);
$upTime = filemtime($imgABPath);
// 广告
if ($config['ad_top']) echo $config['ad_top_info'];
?>
<div class="col-md-12">
<div class="col-md-6" style="text-align: center;">
<img data-toggle="lightbox" src="<?php echo $img_url; ?>" data-image="<?php echo $img_url; ?>" id="img1" class="img-rounded" height="234px" data-caption="<?php echo pathinfo($img_url, PATHINFO_FILENAME); ?>的详细信息" alt="<?php echo $img_url; ?>" />
<div class="col-md-5" style="text-align: center;">
<img data-toggle="lightbox" src="<?php echo $img_url; ?>" data-image="<?php echo $img_url; ?>" id="img1" class="img-rounded" height="432px" data-caption="<?php echo pathinfo($img_url, PATHINFO_FILENAME); ?>的详细信息" alt="<?php echo $img_url; ?>" />
</div>
<div class="col-md-6 table-responsive table-condensed" style="margin-top: 10px;">
<table class="table table-hover table-striped table-bordered">
@ -64,19 +77,50 @@ if ($config['ad_top']) echo $config['ad_top_info'];
</tr>
<tr>
<td>上传时间</td>
<td><?php echo date("Y-m-d H:i:s", $upTime); ?></td>
<td><?php echo $logs[$logsName]['date']; ?></td>
</tr>
<?php if (is_who_login('admin')) : ?>
<tr class="text-primary">
<td>原始名称</td>
<td> <?php echo pathinfo($logs[$logsName]['source'], PATHINFO_FILENAME); ?></td>
</tr>
<tr class="text-primary">
<td>原始大小</td>
<td><?php echo $logs[$logsName]['size']; ?></td>
</tr>
<tr class="text-primary">
<td>上传者IP</td>
<td><?php echo $logs[$logsName]['ip']; ?></td>
</tr>
<tr class="text-primary">
<td>是否监黄</td>
<td><?php echo $logs[$logsName]['checkImg']; ?></td>
</tr>
<tr class="text-primary">
<td>上传来源</td>
<td><?php echo $logs[$logsName]['from']; ?></td>
</tr>
<tr class="text-primary">
<td>文件路径</td>
<td><?php echo $logs[$logsName]['path']; ?></td>
</tr>
<tr class="text-primary">
<td>文件MD5</td>
<td><?php echo $logs[$logsName]['md5']; ?></td>
</tr>
<?php endif; ?>
<tr>
<td>文件操作</td>
<td>
<a class="btn btn-mini btn-primary" href="<?php echo $img_url; ?>" target="_blank"><i class="icon icon-picture"> 查看</i></a>
<a class="btn btn-mini btn-primary" href="" onclick="window.location.replace;"><i class="icon icon-spin icon-refresh"></i> 刷新</a>
<a class="btn btn-mini btn-primary" href="/application/down.php?dw=<?php echo $getIMG; ?>" target="_blank"><i class="icon icon-cloud-download"> 下载</i></a>
<?php if (!empty($config['report'])) : ?>
<?php if (isset($config['report'])) : ?>
<a class="btn btn-mini btn-warning" href="<?php echo $config['report'] . '?Website1=' . $img_url; ?>" target="_blank"><i class="icon icon-question-sign"> 举报</i></a>
<?php endif; ?>
<?php if (is_who_login('admin')) : ?>
<a class="btn btn-mini btn-warning" href="/application/del.php?recycle_url=<?php echo $getIMG; ?>" target="_blank"><i class="icon icon-undo"> 回收</i></a>
<a class="btn btn-mini btn-danger" href="/application/del.php?url=<?php echo $del_url; ?>" target="_blank"><i class="icon icon-trash"> 删除</i></a>
<a class="btn btn-mini btn-warning" href="/application/del.php?url=<?php echo $del_url; ?>" target="_blank"><i class="icon icon-trash"> 删除</i></a>
<?php endif; ?>
</td>
</tr>
@ -125,28 +169,24 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<div class="col-md-12" style="padding-bottom: 10px;">
<h4 class="header-dividing">当月随机图片:</h4>
<div class="cards cards-borderless">
<?php
$logFile = APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php';
if (is_file($logFile)) {
include_once $logFile;
for ($i = 0; $i <= 7; $i++) {
$randName = array_rand($logs, 1);
// echo $img_url . $logs[$randName]['path'];
echo '
<div class="col-md-4 col-sm-6 col-lg-3">
<a class="card" href="?img=' . $logs[$randName]['path'] . '" target="_blank">
<img src="' . $logs[$randName]['path'] . '">
<div class="card-content text-muted text-ellipsis">' . $logs[$randName]['source'] . '</div>
</a>
</div>';
}
} else {
echo '<div class="alert alert-danger">本月还没有上传的图片哟~~ <br />快来上传第一张吧~!</div>';
}
<?php if (is_file(APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php')) :
include_once APP_ROOT . '/admin/logs/upload/' . date('Y-m') . '.php';
for ($i = 0; $i <= 7; $i++) : $randName = array_rand($logs, 1) // echo $img_url . $logs[$randName]['path'];
?>
<div class="col-md-4 col-sm-6 col-lg-3">
<a class="card" href="?img=<?php echo $logs[$randName]['path']; ?>" target="_blank">
<img src="thumb.php?img=<?php echo $logs[$randName]['path']; ?>">
<div class="caption"><?php echo $logs[$randName]['source']; ?></div>
</a>
</div>
<?php endfor;
else : ?>
<p class="alert alert-danger">本月还没有上传的图片哟~~ <br />快来上传第一张吧~!</p>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<script src="<?php static_cdn(); ?>/public/static/EasyImage.js"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/clipboard/clipboard.min.js"></script>
<script>

View File

@ -63,11 +63,12 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<div class="col-md-4 col-sm-6 col-lg-3">
<div class="card">
<li><img src="../public/images/loading.svg" data-image="<?php echo creat_thumbnail_by_list($imgUrl); ?>" data-original="<?php echo $imgUrl; ?>" alt="简单图床-EasyImage"></li>
<!-- <li><img src="holder.js/258x258?theme=sky&text=EasyImage2.0" data-image="< php echo creat_thumbnail_by_list($imgUrl); ?>" data-original="< php echo $imgUrl; ?>" alt="简单图床-EasyImage"></li> -->
<div class="bottom-bar">
<a href="<?php echo $linkUrl; ?>" target="_blank"><i class="icon icon-picture" data-toggle="tooltip" title="原图" style="margin-left:10px;"></i></a>
<a href="<?php echo $linkUrl; ?>" target="_blank"><i class="icon icon-picture" data-toggle="tooltip" title="打开" style="margin-left:10px;"></i></a>
<a href="#" class="copy" data-clipboard-text="<?php echo $linkUrl; ?>" data-toggle="tooltip" title="复制" style="margin-left:10px;"><i class="icon icon-copy"></i></a>
<a href="/application/down.php?dw=<?php echo $relative_path; ?>" data-toggle="tooltip" title="下载" target="_blank" style="margin-left:10px;"><i class="icon icon-cloud-download"></i></a>
<a href="/application/info.php?img=<?php echo $relative_path; ?>" data-toggle="tooltip" title="信息" target="_blank" style="margin-left:10px;"><i class="icon icon-info-sign"></i></a>
<a href="/application/down.php?dw=<?php echo $relative_path; ?>" data-toggle="tooltip" title="下载" target="_blank" style="margin-left:10px;"><i class="icon icon-cloud-download"></i></a>
<?php if (!empty($config['report'])) : ?>
<a href="<?php echo $config['report'] . '?Website1=' . $linkUrl; ?>" target="_blank"><i class="icon icon-question-sign" data-toggle="tooltip" title="举报" style="margin-left:10px;"></i></a>
<?php endif; ?>
@ -181,11 +182,12 @@ if ($config['ad_top']) echo $config['ad_top_info'];
transform: translateY(0);
}
</style>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/bootbox/bootbox.min.js"></script>
<script src="<?php static_cdn(); ?>/public/static/lazyload/lazyload.js"></script>
<script src="<?php static_cdn(); ?>/public/static/viewjs/viewer.min.js"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/clipboard/clipboard.min.js"></script>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/bootbox/bootbox.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/lazyload/lazyload.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/viewjs/viewer.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/clipboard/clipboard.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<script type="application/javascript" src="<?php static_cdn(); ?>/public/static/holder.min.js"></script>
<script>
// viewjs
new Viewer(document.getElementById('viewjs'), {

10
application/randPic.php Normal file
View File

@ -0,0 +1,10 @@
<?php
/**
* 2023-01-29
* 随机图片显示
*/
$img_array = glob('../public/images/*.{gif,jpg,png,jpeg,webp,bmp}', GLOB_BRACE);
if(count($img_array) == 0) die('没找到图片文件。请先上传一些图片到 '.dirname(__FILE__).'/images/ 文件夹');
header('Content-Type: image/png');
echo(file_get_contents($img_array[array_rand($img_array)]));

View File

@ -59,7 +59,7 @@ 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'] . 'cache/');
define('NOT_FOUND_IMAGE', $config['domain'] . '/public/images/404.png');
define('ERROR_IMAGE', $config['domain'] . '/public/images/404.png');
define('DISPLAY_ERROR_MESSAGES', false);

View File

@ -149,7 +149,8 @@ if ($handle->uploaded) {
$delUrl = "Admin closed user delete";
}
// 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-24
// 当设置访问生成缩略图时自动生成 2022-12-30 修正 2023-01-30
$handleThumb = $config['domain'] . '/application/thumb.php?img=' . $pathIMG;
if ($config['thumbnail'] == 2) {
// 自定义缩略图长宽
$handle->image_resize = true;
@ -158,7 +159,8 @@ if ($handle->uploaded) {
// 如果调整后的图像大于原始图像,则取消调整大小,以防止放大
$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/');
$handle->process(APP_ROOT . $config['path'] . 'cache/');
$handleThumb = $config['domain'] . $config['path'] . 'cache/' . $handle->file_dst_name;
}
// 上传成功后返回json数据
@ -167,7 +169,7 @@ if ($handle->uploaded) {
"code" => 200,
"url" => $imageUrl,
"srcName" => $handle->file_src_name_body,
"thumb" => $config['domain'] . '/application/thumb.php?img=' . $pathIMG,
"thumb" => $handleThumb,
"del" => $delUrl,
);
echo json_encode($reJson);

View File

@ -22,7 +22,7 @@ $config=Array
<a href="https://s2.loli.net/2023/01/20/rREU1dJk9HMxDFA.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',
'imgurl'=>'http://192.168.1.13',
'user'=>'admin',
'password'=>'e6e061838856bf47e1de730719fb2609',
'captcha'=>0,
@ -44,7 +44,7 @@ $config=Array
'extensions'=>'gif,jpeg,png,tif,bmp,tif,svg,webp,jpg,tga,ico',
'compress'=>0,
'compress_ratio'=>80,
'thumbnail'=>2,
'thumbnail'=>1,
'thumbnail_w'=>258,
'thumbnail_h'=>258,
'imgConvert'=>'',
@ -103,7 +103,7 @@ $config=Array
'report'=>'',
'image_recycl'=>1,
'tinyfilemanager'=>1,
'delDir'=>'thumbnails/',
'delDir'=>'cache/',
'hide'=>0,
'hide_key'=>'EasyImage2.0',
'hide_path'=>0,
@ -111,7 +111,7 @@ $config=Array
'guest_path_status'=>0,
'token_path_status'=>0,
'admin_path'=>'u',
'update'=>'2023-01-26 12:27:53',
'update'=>'2023-01-30 05:58:27',
'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>

View File

@ -14,7 +14,7 @@ mustLogin();
</div>
</div>
</div>
<div id='upShowID' class="uploader col-md-12 clo-xs-12" data-ride="uploader" data-url="/application/upload.php">
<div id='upShowID' class="uploader col-md-12 clo-xs-12" readonly="readonly" data-ride="uploader" data-url="/application/upload.php">
<div class="uploader-message text-center">
<div class="content"></div>
<button type="button" class="close">x</button>
@ -29,21 +29,24 @@ mustLogin();
</div>
<div class="col-md-12 clo-xs-12">
<ul class="nav nav-tabs">
<li <?php if ($config['upload_first_show'] == 1) echo 'class="active"'; ?>>
<a href="#" data-target="#tab2Content1" data-toggle="tab"><i class="icon icon-link"></i> 直链</a>
<li <?php if ($config['upload_first_show'] == 1) echo 'class="active"'; ?> data-toggle="tooltip" title="图片直链">
<a href="#" data-target="#tab2Content1" data-toggle="tab"><i class="icon icon-picture"></i></a>
</li>
<li <?php if ($config['upload_first_show'] == 2) echo 'class="active"'; ?>>
<a href="#" data-target="#tab2Content2" data-toggle="tab"><i class="icon icon-chat"></i> 论坛代码</a>
<li <?php if ($config['upload_first_show'] == 2) echo 'class="active"'; ?> data-toggle="tooltip" title="论坛代码">
<a href="#" data-target="#tab2Content2" data-toggle="tab"><i class="icon icon-chat"></i></a>
</li>
<li <?php if ($config['upload_first_show'] == 3) echo 'class="active"'; ?>>
<a href="#" data-target="#tab2Content3" data-toggle="tab"><i class="icon icon-code"></i> MarkDown</a>
<li <?php if ($config['upload_first_show'] == 3) echo 'class="active"'; ?> data-toggle="tooltip" title="Markdown">
<a href="#" data-target="#tab2Content3" data-toggle="tab"><i class="icon icon-code"></i></a>
</li>
<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 <?php if ($config['upload_first_show'] == 4) echo 'class="active"'; ?> data-toggle="tooltip" title="HTML链接">
<a href="#" data-target="#tab2Content4" data-toggle="tab"><i class="icon icon-html5"></i></a>
</li>
<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 <?php if ($config['upload_first_show'] == 5) echo 'class="active"'; ?> data-toggle="tooltip" title="缩略图">
<a href="#" data-target="#tab2Content5" data-toggle="tab"><i class="icon icon-camera"></i></a>
</li>
<li <?php if ($config['upload_first_show'] == 6) echo 'class="active"';
if ($config['show_user_hash_del'] == 0) echo 'style="display:none;"' ?> data-toggle="tooltip" title="删除链接">
<a href="#" data-target="#tab2Content6" data-toggle="tab"><i class="icon icon-trash"></i></a>
</li>
</ul>
<div class="tab-content" style="text-align:right;">
@ -68,9 +71,14 @@ mustLogin();
<button id="btnHtml" class="btn btn-primary copyBtn4" data-loading-text="已经复制链接..." style="margin-top:10px;"><i class="icon icon-copy"></i> 复制</button>
</div>
<div class="tab-pane fade <?php if ($config['upload_first_show'] == 5) echo 'active in'; ?>" id="tab2Content5">
<textarea class="form-control" rows="5" id="thumb" readonly></textarea>
<button class="btn btn-primary" style="margin-top:10px;" onclick="location.reload()"><i class="icon icon-undo"></i> 刷新</button>
<button id="btnThumb" class="btn btn-primary copyBtn5" data-loading-text="已经复制链接..." style="margin-top:10px;"><i class="icon icon-copy"></i> 复制</button>
</div>
<div class="tab-pane fade <?php if ($config['upload_first_show'] == 6) echo 'active in'; ?>" id="tab2Content6">
<textarea class="form-control" rows="5" id="del" readonly></textarea>
<button class="btn btn-primary" style="margin-top:10px;" onclick="location.reload()"><i class="icon icon-undo"></i> 刷新</button>
<button id="btndel" class="btn btn-primary copyBtn5" data-loading-text="已经复制链接..." style="margin-top:10px;"><i class="icon icon-copy"></i> 复制</button>
<button id="btnDel" class="btn btn-primary copyBtn6" data-loading-text="已经复制链接..." style="margin-top:10px;"><i class="icon icon-copy"></i> 复制</button>
</div>
</div>
</div>
@ -149,6 +157,7 @@ mustLogin();
document.getElementById("bbscode").innerHTML += "[img]" + obj.url + "[/img]\r\n";
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("thumb").innerHTML += obj.thumb + "\r\n";
document.getElementById("del").innerHTML += obj.del + "\r\n";
new $.zui.Messager(obj.srcName + "上传成功", {
type: "primary", // 定义颜色主题

1
public/images/file.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1674710977078" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="39463" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M659.72 64.19H270.4c-78.06 0-141.33 63.28-141.33 141.33v612.95c0 78.06 63.28 141.33 141.33 141.33h485.49c78.06 0 141.33-63.28 141.33-141.33V301.69c0-31.83-12.64-62.35-35.15-84.85l-117.5-117.5a120.017 120.017 0 0 0-84.85-35.15z" fill="#53B7F4" p-id="39464"></path><path d="M862.07 216.84l-117.5-117.5a120.001 120.001 0 0 0-61.75-32.9v131.88c0 41.87 33.94 75.81 75.81 75.81H894a119.975 119.975 0 0 0-31.93-57.29zM529.42 366.1l-51.53 51.53c-7.81 7.81-7.81 20.47 0 28.28 7.81 7.81 20.47 7.81 28.28 0l51.53-51.53c26.21-26.21 68.85-26.21 95.06 0s26.21 68.85 0 95.06l-51.53 51.53c-26.21 26.21-68.85 26.21-95.06 0a67.079 67.079 0 0 1-7.88-9.48c-6.24-9.11-18.69-11.44-27.8-5.19-9.12 6.25-11.44 18.69-5.19 27.8 3.7 5.4 7.94 10.5 12.59 15.15 41.8 41.8 109.82 41.8 151.63 0l51.53-51.53c41.8-41.8 41.8-109.82 0-151.63-41.81-41.8-109.83-41.8-151.63 0.01z" fill="#29A3D3" p-id="39465"></path><path d="M520.11 622.09l-51.53 51.53c-26.21 26.21-68.85 26.21-95.06 0-26.21-26.21-26.21-68.85 0-95.06l51.53-51.53c26.21-26.21 68.85-26.21 95.06 0 2.76 2.76 5.28 5.77 7.5 8.94 6.33 9.05 18.8 11.25 27.85 4.92s11.25-18.8 4.92-27.85c-3.55-5.08-7.59-9.88-11.99-14.28-41.8-41.8-109.82-41.8-151.63 0l-51.53 51.53c-41.8 41.8-41.8 109.82 0 151.62 41.8 41.8 109.82 41.8 151.63 0l51.53-51.53c7.81-7.81 7.81-20.47 0-28.28-7.81-7.82-20.47-7.82-28.28-0.01z" fill="#29A3D3" p-id="39466"></path><path d="M681.04 354.1c-41.8-41.8-109.82-41.8-151.63 0l-51.53 51.53c-7.81 7.81-7.81 20.47 0 28.28 7.81 7.81 20.47 7.81 28.28 0l51.53-51.53c26.21-26.21 68.85-26.21 95.06 0s26.21 68.85 0 95.06l-51.53 51.53c-26.21 26.21-68.85 26.21-95.06 0a67.079 67.079 0 0 1-7.88-9.48c-6.24-9.11-18.69-11.44-27.8-5.19-9.12 6.25-11.44 18.69-5.19 27.8 3.7 5.4 7.94 10.5 12.59 15.15 41.8 41.8 109.82 41.8 151.63 0l51.53-51.53c41.81-41.8 41.81-109.82 0-151.62z" fill="#FFFFFF" p-id="39467"></path><path d="M520.11 610.09l-51.53 51.53c-26.21 26.21-68.85 26.21-95.06 0-26.21-26.21-26.21-68.85 0-95.06l51.53-51.53c26.21-26.21 68.85-26.21 95.06 0 2.76 2.76 5.28 5.77 7.5 8.94 6.33 9.05 18.8 11.25 27.85 4.92s11.25-18.8 4.92-27.85c-3.55-5.08-7.59-9.88-11.99-14.28-41.8-41.8-109.82-41.8-151.63 0l-51.53 51.53c-41.8 41.8-41.8 109.82 0 151.62 41.8 41.8 109.82 41.8 151.63 0l51.53-51.53c7.81-7.81 7.81-20.47 0-28.28-7.81-7.82-20.47-7.82-28.28-0.01z" fill="#FFFFFF" p-id="39468"></path></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,11 +0,0 @@
<?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>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,172 +1,149 @@
/**
* 来自于copy_btn.js paste.js合并
* 简单图床-复制
* 2023-01-30
*/
var copyBtn = document.getElementsByClassName('copyBtn1')[0];
copyBtn.onclick = function() {
copyBtn.onclick = function () {
var copyVal = document.getElementById("links");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
}, function () {
//fail info
alert("复制失败");
}
});
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn2')[0];
copyBtn.onclick = function() {
copyBtn.onclick = function () {
var copyVal = document.getElementById("bbscode");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
}, function () {
//fail info
alert("复制失败");
}
});
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn3')[0];
copyBtn.onclick = function() {
copyBtn.onclick = function () {
var copyVal = document.getElementById("markdown");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
}, function () {
//fail info
alert("复制失败");
}
});
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn4')[0];
copyBtn.onclick = function() {
copyBtn.onclick = function () {
var copyVal = document.getElementById("html");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
}, function () {
//fail info
alert("复制失败");
}
});
} catch (err) {
//fail info
alert(err);
}
}
var copyBtn = document.getElementsByClassName('copyBtn5')[0];
copyBtn.onclick = function() {
var copyVal = document.getElementById("del");
copyBtn.onclick = function () {
var copyVal = document.getElementById("thumb");
copyVal.select();
try {
if (document.execCommand('copy', false, null)) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
}, function () {
//fail info
alert("复制失败");
}
});
} catch (err) {
//fail info
alert(err);
}
}
// btn状态
$('#btnLinks').on('click', function() {
var $btn = $(this);
$btn.button('loading');
var copyBtn = document.getElementsByClassName('copyBtn6')[0];
copyBtn.onclick = function () {
var copyVal = document.getElementById("del");
copyVal.select();
try {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
}, function () {
//fail info
alert("复制失败");
});
} catch (err) {
alert(err);
}
}
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function() {
$btn.button('reset');
}, 2000);
// 按钮状态
$('#btnLinks, #btnBbscode, #btnMarkDown, #btnHtml, #btnThumb, #btnDel').on('click', function () {
$(this).button('loading').delay(2000).queue(function () {
$(this).button('reset');
})
});
$('#btnBbscode').on('click', function() {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function() {
$btn.button('reset');
}, 2000);
});
$('#btnMarkDown').on('click', function() {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function() {
$btn.button('reset');
}, 2000);
});
$('#btnHtml').on('click', function() {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function() {
$btn.button('reset');
}, 2000);
});
$('#btndel').on('click', function() {
var $btn = $(this);
$btn.button('loading');
// 此处使用 setTimeout 来模拟你的复杂功能逻辑
setTimeout(function() {
$btn.button('reset');
}, 2000);
});
/****************************************************************
* 复制截图 简单图床修改版
*/
(function() {
document.addEventListener('paste', function(e) {
(function () {
document.addEventListener('paste', function (e) {
var items = ((e.clipboardData || window.clipboardData).items) || [];
var file = null;
@ -180,15 +157,42 @@ $('#btndel').on('click', function() {
}
if (!file) {
alert('粘贴内容非图片!');
$.zui.messager.show('粘贴内容非图片!', {
icon: 'bell',
time: 3000,
type: 'danger',
placement: 'top'
});
return;
}
var formData = new FormData();
formData.append('file', file);
var xhr = new XMLHttpRequest();
xhr.onload = function() {
try {
xhr.onreadystatechange = function () {
if (xhr.readyState == 1) {
$.zui.messager.show('粘贴上传中...', {
icon: 'bell',
time: 3000,
type: 'primary',
placement: 'top'
});
$(".uploader").addClass("load-indicator loading"); // 增加正在上传状态
}
if (xhr.readyState >= 4) {
$.zui.messager.show('粘贴上传中...', {
icon: 'bell',
time: 3000,
type: 'primary',
placement: 'top'
});
$(".uploader").removeClass("load-indicator loading"); // 移除正在上传状态
}
}
xhr.onload = function () {
var result = JSON.parse(this.responseText);
if (result.result === 'success') {
var links = document.getElementById("links");
@ -203,18 +207,35 @@ $('#btndel').on('click', function() {
var html = document.getElementById("html");
html.innerHTML += "&lt;img src=\"" + result.url + "\" /&#62;\n";
var del = document.getElementById("thumb");
del.innerHTML += result.thumb + "\n";
var del = document.getElementById("del");
del.innerHTML += result.del + "\n";
$.zui.messager.show('粘贴上传成功...', {
icon: 'bell',
time: 4000,
type: 'success',
placement: 'top'
});
} else {
alert('上传失败1');
}
} catch (e) {
alert('上传失败2');
$.zui.messager.show('上传失败...' + result.message, {
icon: 'bell',
time: 4000,
type: 'primary',
placement: 'top'
});
}
};
xhr.onerror = function() {
alert('上传失败3');
xhr.onerror = function () {
$.zui.messager.show('因网络问题导致的上传失败...', {
icon: 'bell',
time: 4000,
type: 'primary',
placement: 'top'
});
};
xhr.open('POST', './application/upload.php', true);
xhr.send(formData);
@ -223,7 +244,7 @@ $('#btndel').on('click', function() {
/******************************************************************/
// 导航状态
$('.nav-pills').find('a').each(function() {
$('.nav-pills').find('a').each(function () {
if (this.href == document.location.href) {
$(this).parent().addClass('active'); // this.className = 'active';
}

14
public/static/holder.min.js vendored Normal file

File diff suppressed because one or more lines are too long