更新新文件,修复压缩问题,更改一些样式。
pull/18/head
icret 2021-07-17 13:27:19 +08:00 committed by GitHub
parent cbedb0e32f
commit fe1779213d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 2234 additions and 2435 deletions

View File

@ -1,192 +1,192 @@
<?php
/*
* API 页面管理
*/
require_once '../libs/header.php';
require_once APP_ROOT . '/config/api_key.php';
require_once APP_ROOT . '/api/libs//apiFunction.php';
// 检测登录
if (!is_online()) {
checkLogin();
}
// 查找用户ID或者Token
if (isset($_POST['radio'])) {
if ($_POST['radio'] == 'id') {
$radio_value = '用户token' . getIDToken($_POST['radio-value']);
} elseif ($_POST['radio'] == 'token') {
$radio_value = '用户ID' . getID($_POST['radio-value']);
} else {
$radio_value = null;
}
}
// 删除非空目录
if (isset($_POST['delDir'])) {
$delDir = APP_ROOT . $config['path'] . $_POST['delDir'];
if (deldir($delDir)) {
echo '
<script> new $.zui.Messager("删除成功!", {type: "success" // 定义颜色主题
}).show();</script>';
header("refresh:1;"); // 1s后刷新当前页面
} else {
echo '
<script> new $.zui.Messager("删除失败!", {type: "danger" // 定义颜色主题
}).show();</script>';
header("refresh:1;"); // 1s后刷新当前页面
}
}
?>
<div class="container">
</div class="row">
<div class="col-md-12">
<div class="alert alert-primary">
<h3 style="text-align:center">EasyImage2.0 快捷操作中心</h2>
<hr />
<h5>此页面为常用快捷操作,目录保存以 /// 递进,非必要请勿修改!否则会导致部分操作不可用。</h5>
<h5>当前软件环境信息PHP版本<?php echo phpversion(); ?>PHP上传最大值<?php echo ini_get('upload_max_filesize'); ?>POST上传最大值<?php echo ini_get('post_max_size'); ?></h5>
<h5><?php
$yesterday = date("Y/m/d/", strtotime("-1 day"));
echo '今日上传数量:' . getFileNumber(APP_ROOT . config_path()) . ' 昨日上传数量:' . getFileNumber(APP_ROOT . $config['path'] . $yesterday) . ' 占用空间:' . getDistUsed(disk_total_space(__DIR__) - disk_free_space(__DIR__)) . ' 剩余空间:' . getDistUsed(disk_free_space(__DIR__)); ?>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<form class="form-condensed" action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<label for="exampleInputMoney1">
新Token需按要求填入
<code>
/config/api_key.php
</code>
才生效
</label>
<div class="input-group">
<span class="input-group-addon">
New Token
</span>
<input type="text" class="form-control" id="exampleInputMoney1" value="<?php echo privateToken(); ?>">
</div>
</div>
<div class="col-md-4">
<form></form>
<form class="form-condensed" action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<div class="form-group">
<label for="exampleInputAccount6">根据ID/Token查找用户信息</label>
<input type="text" name="radio-value" id="exampleInputAccount6" class="form-control" placeholder="输入信息" value="<?php echo @$radio_value; ?>">
<div class="radio-primary"><input type="radio" name="radio" value="id" id="primaryradio1" checked="checked"><label for="primaryradio1">根据ID查找用户Token</label></div>
<div class="radio-primary"><input type="radio" name="radio" value="token" id="primaryradio2"><label for="primaryradio2">根据Token查找用户ID</label></div>
<button type="submit" class="btn btn-mini btn-primary">
查找
</button>
</div>
</form>
</div>
<div class="col-md-4">
<div id="delimgurl"></div>
<div id="title"></div>
<form class="form-condensed" method="get" action="del.php" id="form" name="delForm" onSubmit="getStr();" target="_blank">
<div class="form-group">
<label for="del">
删除图片
</label>
<input type="url" name="url" class="form-control" id="del" placeholder="请输入图片链接" />
</div>
<label>格式:<code>https://i1.100024.xyz/i/2021/05/04/10fn9ei.jpg</code></label>
<input type="submit" class="btn btn-mini btn-primary" value="删除" />
</form>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<form action="../libs/compressing.php" method="post" target="_blank">
<div class="form-group">
<label for="exampleInputInviteCode1">压缩文件夹内图片(格式2021/05/10/)</label>
<input type="text" class="form-control form-date" placeholder="" name="folder" value="<?php echo date('Y/m/d/'); ?>" readonly="">
</div>
<div class="radio">
<label>
<input type="radio" name="type" value="Imgcompress" checked="checked"> 使用本地压缩(默认上传已压缩,不需重复压缩)
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="type" value="TinyImg"> 使用TinyImag压缩需要申请key)
</label>
</div>
<div>
<label>
* 如果页面长时间没有响应,表示正面正在压缩!
</label>
<label>
两种压缩均为不可逆,并且非常占用硬件资源。
</label>
</div>
<button type="submit" class="btn btn-mini btn-success">开始压缩</button>
</form>
</div>
<div class="col-md-4">
<table class="table table-hover table-bordered table-condensed table-responsive">
<thead>
<tr>
<th>当前可用Token列表</th>
</tr>
</thead>
<tbody>
<?php
foreach ($tokenList as $value) {
echo '<tr><td>' . $value . '</td></tr>';
}
?>
</tbody>
</table>
</div>
<div class="col-md-4">
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<div class="form-group">
<label for="exampleInputInviteCode1" style="color:red">删除所选日期文件夹(删除之后无法恢复!):</label>
<input type="text" class="form-control form-date" name="delDir" value="<?php echo date('Y/m/d/'); ?>" readonly="">
</div>
<button type="submit" class="btn btn-mini btn-danger" onClick="return confirm('确认要删除?\n* 删除文件夹后将无法恢复!');">删除目录</button>
</form>
</div>
</div>
</div>
</div>
</div>
<link href="../public/static/zui/lib/datetimepicker/datetimepicker.min.css" rel="stylesheet">
<script src="../public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<script>
// 动态显示要删除的图片
var oBtn = document.getElementById('del');
var oTi = document.getElementById('title');
if ('oninput' in oBtn) {
oBtn.addEventListener("input", getWord, false);
} else {
oBtn.onpropertychange = getWord;
}
function getWord() {
var delimgurl = document.getElementById("delimgurl");
delimgurl.innerHTML += '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
// 仅选择日期
$(".form-date").datetimepicker({
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
minView: 2,
forceParse: 0,
format: "yyyy/mm/dd/"
});
// Title
document.title = "管理中心 - <?php echo $config['title']; ?>";
</script>
<?php require_once APP_ROOT . '/libs/footer.php';
<?php
/*
* API 页面管理
*/
require_once '../libs/header.php';
require_once APP_ROOT . '/config/api_key.php';
require_once APP_ROOT . '/api/libs//apiFunction.php';
// 检测登录
if (!is_online()) {
checkLogin();
}
// 查找用户ID或者Token
if (isset($_POST['radio'])) {
if ($_POST['radio'] == 'id') {
$radio_value = '用户token' . getIDToken($_POST['radio-value']);
} elseif ($_POST['radio'] == 'token') {
$radio_value = '用户ID' . getID($_POST['radio-value']);
} else {
$radio_value = null;
}
}
// 删除非空目录
if (isset($_POST['delDir'])) {
$delDir = APP_ROOT . $config['path'] . $_POST['delDir'];
if (deldir($delDir)) {
echo '
<script> new $.zui.Messager("删除成功!", {type: "success" // 定义颜色主题
}).show();</script>';
header("refresh:1;"); // 1s后刷新当前页面
} else {
echo '
<script> new $.zui.Messager("删除失败!", {type: "danger" // 定义颜色主题
}).show();</script>';
header("refresh:1;"); // 1s后刷新当前页面
}
}
?>
<div class="container">
</div class="row">
<div class="col-md-12">
<div class="alert alert-primary">
<h3 style="text-align:center">EasyImage2.0 快捷操作中心</h2>
<hr />
<h5>此页面为常用快捷操作,目录保存以 /// 递进,非必要请勿修改!否则会导致部分操作不可用。</h5>
<h5>当前软件环境信息PHP版本<?php echo phpversion(); ?>PHP上传最大值<?php echo ini_get('upload_max_filesize'); ?>POST上传最大值<?php echo ini_get('post_max_size'); ?></h5>
<h5><?php
$yesterday = date("Y/m/d/", strtotime("-1 day"));
echo '今日上传数量:' . getFileNumber(APP_ROOT . config_path()) . ' 昨日上传数量:' . getFileNumber(APP_ROOT . $config['path'] . $yesterday) . ' 占用空间:' . getDistUsed(disk_total_space(__DIR__) - disk_free_space(__DIR__)) . ' 剩余空间:' . getDistUsed(disk_free_space(__DIR__)); ?>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<form class="form-condensed" action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<label for="exampleInputMoney1">
新Token需按要求填入
<code>
/config/api_key.php
</code>
才生效
</label>
<div class="input-group">
<span class="input-group-addon">
New Token
</span>
<input type="text" class="form-control" id="exampleInputMoney1" value="<?php echo privateToken(); ?>">
</div>
</div>
<div class="col-md-4">
<form></form>
<form class="form-condensed" action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<div class="form-group">
<label for="exampleInputAccount6">根据ID/Token查找用户信息</label>
<input type="text" name="radio-value" id="exampleInputAccount6" class="form-control" placeholder="输入信息" value="<?php echo @$radio_value; ?>">
<div class="radio-primary"><input type="radio" name="radio" value="id" id="primaryradio1" checked="checked"><label for="primaryradio1">根据ID查找用户Token</label></div>
<div class="radio-primary"><input type="radio" name="radio" value="token" id="primaryradio2"><label for="primaryradio2">根据Token查找用户ID</label></div>
<button type="submit" class="btn btn-mini btn-primary">
查找
</button>
</div>
</form>
</div>
<div class="col-md-4">
<div id="delimgurl"></div>
<div id="title"></div>
<form class="form-condensed" method="get" action="del.php" id="form" name="delForm" onSubmit="getStr();" target="_blank">
<div class="form-group">
<label for="del">
删除图片
</label>
<input type="url" name="url" class="form-control" id="del" placeholder="请输入图片链接" />
</div>
<label>格式:<code>https://i1.100024.xyz/i/2021/05/04/10fn9ei.jpg</code></label>
<input type="submit" class="btn btn-mini btn-primary" value="删除" />
</form>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<form action="../libs/compressing.php" method="post" target="_blank">
<div class="form-group">
<label for="exampleInputInviteCode1">压缩文件夹内图片(格式2021/05/10/)</label>
<input type="text" class="form-control form-date" placeholder="" name="folder" value="<?php echo date('Y/m/d/'); ?>" readonly="">
</div>
<div class="radio">
<label>
<input type="radio" name="type" value="Imgcompress" checked="checked"> 使用本地压缩(默认上传已压缩,不需重复压缩)
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="type" value="TinyImg"> 使用TinyImag压缩需要申请key)
</label>
</div>
<div>
<label>
* 如果页面长时间没有响应,表示正面正在压缩!
</label>
<label>
两种压缩均为不可逆,并且非常占用硬件资源。
</label>
</div>
<button type="submit" class="btn btn-mini btn-success">开始压缩</button>
</form>
</div>
<div class="col-md-4">
<table class="table table-hover table-bordered table-condensed table-responsive">
<thead>
<tr>
<th>当前可用Token列表</th>
</tr>
</thead>
<tbody>
<?php
foreach ($tokenList as $value) {
echo '<tr><td>' . $value . '</td></tr>';
}
?>
</tbody>
</table>
</div>
<div class="col-md-4">
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<div class="form-group">
<label for="exampleInputInviteCode1" style="color:red">删除所选日期文件夹(删除之后无法恢复!):</label>
<input type="text" class="form-control form-date" name="delDir" value="<?php echo date('Y/m/d/'); ?>" readonly="">
</div>
<button type="submit" class="btn btn-mini btn-danger" onClick="return confirm('确认要删除?\n* 删除文件夹后将无法恢复!');">删除目录</button>
</form>
</div>
</div>
</div>
</div>
</div>
<link href="../public/static/zui/lib/datetimepicker/datetimepicker.min.css" rel="stylesheet">
<script src="../public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<script>
// 动态显示要删除的图片
var oBtn = document.getElementById('del');
var oTi = document.getElementById('title');
if ('oninput' in oBtn) {
oBtn.addEventListener("input", getWord, false);
} else {
oBtn.onpropertychange = getWord;
}
function getWord() {
var delimgurl = document.getElementById("delimgurl");
delimgurl.innerHTML += '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
// 仅选择日期
$(".form-date").datetimepicker({
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
minView: 2,
forceParse: 0,
format: "yyyy/mm/dd/"
});
// Title
document.title = "管理中心 - <?php echo $config['title']; ?>";
</script>
<?php require_once APP_ROOT . '/libs/footer.php';

View File

@ -1,38 +1,38 @@
<?php
echo '<title> - EasyImage2.0</title>';
require_once '../../libs/function.php';
require_once APP_ROOT . '/libs/header.php';
require_once APP_ROOT . '/config/api_key.php';
// 如果关闭Api上传并且没有登录的情况下关闭测试接口
if (!$config['apiStatus'] and !is_online()) {
exit('<script>
new $.zui.Messager("Api关闭请登录", {type: "danger" // 定义颜色主题
}).show();
// 延时2s跳转
window.setTimeout("window.location=\'/../libs/login.php \'",2000);
</script>');
}
?>
<div class="container">
</div class="row">
<div class="col-md-12">
<h4>测试Token<code><?php echo $tokenList['1']; ?></code></h4>
<form action="../index.php" method="post" enctype="multipart/form-data" class="form-inline" target="_blank">
<div class="form-group">
<input type="file" name="image" accept="image/*" class="form-control" />
</div>
<div class="form-group">
<input type="text" name="token" placeholder="请输入Token" class="form-control" />
</div>
<button type="submit" class="btn btn-primary">上传</button>
</form>
</div>
</div>
</div>
<script>
document.title = "API图片上传测试 - <?php echo $config['title']; ?>";
</script>
<?php require_once APP_ROOT . '/libs/footer.php';
<?php
echo '<title> - EasyImage2.0</title>';
require_once '../../libs/function.php';
require_once APP_ROOT . '/libs/header.php';
require_once APP_ROOT . '/config/api_key.php';
// 如果关闭Api上传并且没有登录的情况下关闭测试接口
if (!$config['apiStatus'] and !is_online()) {
exit('<script>
new $.zui.Messager("Api关闭请登录", {type: "danger" // 定义颜色主题
}).show();
// 延时2s跳转
window.setTimeout("window.location=\'/../libs/login.php \'",2000);
</script>');
}
?>
<div class="container">
</div class="row">
<div class="col-md-12">
<h4>测试Token<code><?php echo $tokenList['1']; ?></code></h4>
<form action="../index.php" method="post" enctype="multipart/form-data" class="form-inline" target="_blank">
<div class="form-group">
<input type="file" name="image" accept="image/*" class="form-control" />
</div>
<div class="form-group">
<input type="text" name="token" placeholder="请输入Token" class="form-control" />
</div>
<button type="submit" class="btn btn-primary">上传</button>
</form>
</div>
</div>
</div>
<script>
document.title = "API图片上传测试 - <?php echo $config['title']; ?>";
</script>
<?php require_once APP_ROOT . '/libs/footer.php';

View File

@ -1,80 +1,81 @@
<?php
/**
* 删除文件页面
*/
require_once '../libs/header.php';
require_once APP_ROOT . '/libs/function.php';
echo '<div class="col-md-4 col-md-offset-4">
<div id="title" style="margin: 10px;"></div>
<form class="form-inline" method="get" action="' . $_SERVER['PHP_SELF'] . '" id="form" name="delForm" onSubmit="getStr();">
<div class="form-group">
<label for="exampleInputInviteCode3">删除图片-格式:</label>
<input type="text" class="form-control" id="exampleInputInviteCode3" name="url" placeholder="https://i1.100024.xyz/i/2021/05/04/10fn9ei.jpg">
</div>
<button type="submit" class="btn btn-danger">删除</button>
</form>
</div>
';
if (empty($_REQUEST)) {
echo '
<script>
new $.zui.Messager("没有要删除的图片!", {type: "danger" // 定义颜色主题
}).show();
// 延时3.5s跳转
window.setTimeout("window.location=\'/../ \'",3500);
</script>
';
} elseif (isset($_GET['url'])) {
$img = $_GET['url'];
echo '
<div class="col-md-12">
<hr />
<a href="' . $img . '" target="_blank"><img src="' . $img . '" alt="简单图床-EasyImage" class="img-thumbnail"></a>
</div>';
}
// 解密删除
if (isset($_GET['hash'])) {
$delHash = $_GET['hash'];
$delHash = urlHash($delHash, 1);
getDel($delHash, 'hash');
}
// 检查登录后再处理url删除请求
if (is_online()) {
if (isset($_GET['url'])) {
getDel($_GET['url'], 'url');
}
} else {
if (isset($_GET['url'])) {
echo '
<script>
new $.zui.Messager("请登录后再删除", {type: "danger" // 定义颜色主题
}).show();
// 延时2s跳转
window.setTimeout("window.location=\'/../libs/login.php \'",2000);
</script>
';
}
}
require_once APP_ROOT . '/libs/footer.php';
?>
<script>
// 修改网页标题
document.title = "删除图片 - <?php echo $config['title']; ?>";
var oBtn = document.getElementById('del');
var oTi = document.getElementById('title');
if ('oninput' in oBtn) {
oBtn.addEventListener("input", getWord, false);
} else {
oBtn.onpropertychange = getWord;
}
function getWord() {
oTi.innerHTML = '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
<?php
/**
* 删除文件页面
*/
require_once '../libs/header.php';
require_once APP_ROOT . '/libs/function.php';
echo '<div class="col-md-4 col-md-offset-4">
<div id="title" style="margin: 10px;"></div>
<form class="form-inline" method="get" action="' . $_SERVER['PHP_SELF'] . '" id="form" name="delForm" onSubmit="getStr();">
<div class="form-group">
<label for="exampleInputInviteCode3">删除图片-格式:</label>
<input type="text" class="form-control" id="exampleInputInviteCode3" name="url" placeholder="https://i1.100024.xyz/i/2021/05/04/10fn9ei.jpg">
</div>
<button type="submit" class="btn btn-danger">删除</button>
</form>
</div>
';
if (empty($_REQUEST)) {
echo '
<script>
new $.zui.Messager("没有要删除的图片!", {type: "danger" // 定义颜色主题
}).show();
// 延时3.5s跳转
window.setTimeout("window.location=\'/../ \'",3500);
</script>
';
} elseif (isset($_GET['url'])) {
$img = $_GET['url'];
echo '
<div class="col-md-12">
<hr />
<div style="text-align:center;"><span class="label">图片属性:'.@getimagesize($img)[0].'px X '.@getimagesize($img)[1].'px</span></div>
<a href="' . $img . '" target="_blank"><img src="' . $img . '" alt="简单图床-EasyImage" class="img-thumbnail"></a>
</div>';
}
// 解密删除
if (isset($_GET['hash'])) {
$delHash = $_GET['hash'];
$delHash = urlHash($delHash, 1);
getDel($delHash, 'hash');
}
// 检查登录后再处理url删除请求
if (is_online()) {
if (isset($_GET['url'])) {
getDel($_GET['url'], 'url');
}
} else {
if (isset($_GET['url'])) {
echo '
<script>
new $.zui.Messager("请登录后再删除", {type: "danger" // 定义颜色主题
}).show();
// 延时2s跳转
window.setTimeout("window.location=\'/../libs/login.php \'",2000);
</script>
';
}
}
require_once APP_ROOT . '/libs/footer.php';
?>
<script>
// 修改网页标题
document.title = "删除图片 - <?php echo $config['title']; ?>";
var oBtn = document.getElementById('del');
var oTi = document.getElementById('title');
if ('oninput' in oBtn) {
oBtn.addEventListener("input", getWord, false);
} else {
oBtn.onpropertychange = getWord;
}
function getWord() {
oTi.innerHTML = '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
</script>

View File

@ -2,6 +2,7 @@
require_once __DIR__ . './../libs/function.php';
require_once APP_ROOT . '/api/libs/apiFunction.php';
require_once APP_ROOT . '/libs/class.upload.php';
require_once APP_ROOT . '/libs/WaterMask.php';
require_once APP_ROOT . '/config/api_key.php';
// 检查是否开启api上传

View File

@ -1,22 +1,22 @@
<?php
/**
* 此文件用来存放各种key
* 2021-5-8 22:04:55
*/
$Api_Key = [
// 填写 TinyImag Key 申请地址https://tinypng.com/developers
'TinyImag' => '****7pPVQc9P***4Jvd2zH*****'
];
/*
* Token list 请在此填写需要配置Token的用户 前边编号有助于识别上传者ID
* 格式: ID数字需要从0开始,顺序添加)=> Token注意后边',')
*/
$tokenList = array(
0 => '8337effca0ddfcd9c5899f3509b23657',
1 => '1c17b11693cb5ec63859b091c5b9c1b2',
);
<?php
/**
* 此文件用来存放各种key
* 2021-5-8 22:04:55
*/
$Api_Key = [
// 填写 TinyImag Key 申请地址https://tinypng.com/developers
'TinyImag' => '****7pPVQc9P***4Jvd2zH*****'
];
/*
* Token list 请在此填写需要配置Token的用户 前边编号有助于识别上传者ID
* 格式: ID数字需要从0开始,顺序添加)=> Token注意后边',')
*/
$tokenList = array(
0 => '8337effca0ddfcd9c5899f3509b23657',
1 => '1c17b11693cb5ec63859b091c5b9c1b2',
);

View File

@ -1,320 +1,318 @@
<?php
/**
* EasyImage2.0 - 简单图床配置
* @author icret
* @email lemonim@qq.com
* @Github https://github.com/icret/easyImages2.0
* QQ Group 623688684
* @Last 2021-5-25 21:12:34
* 上传后请打开check.php先检查服务器配置更改密码等操作
* 安装完毕后请删除README.md,check.php,LICENSE等非必要文件
* 敬请注意本程序为开源程序你可以使用本程序在任何的商业、非商业项目或者网站中。但请你务必保留代码中相关信息页面logo和页面上必要的链接可以清除
* 本人仅为程序开源创作,如非法网站与本人无关,请勿用于非法用途
* 请为本人博客www.545141.com加上网址链接谢谢支持。作为开发者你可以对相应的后台功能进行扩展增删改相应代码,但请保留代码中相关来源信息(例如:本人博客,邮箱等)
* 如果因安装问题或其他问题可以给我发邮件。
*
* 配置分为三大区块 - 1.基础配置 2.图床配置 3.tinyfilemanager管理配置
*/
/*---------------基础配置-------------------*/
// 设置html为utf8
@header('Content-Type:text/html;charset=utf-8');
//将时区设置为中国·上海
@ini_set('date.timezone', 'Asia/Shanghai');
@date_default_timezone_set('Asia/Shanghai');
// 修改内存限制 根据服务器配置选择低于128M容易出现上传失败你懂得图片挺占用内存的
@ini_set('memory_limit', '512M');
// 定义根目录
@define('APP_ROOT', str_replace('\\', '/', realpath(dirname(__FILE__) . '/../')));
/*---------------图床配置-------------------*/
$config = array(
// 网站标题
'title' => '简单图床 - EasyImage',
// 网站关键字
'keywords' => '简单图床,easyimage,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制',
// 网站描述
'description' => '简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序最新html5自适应页面兼容手机电脑上传后返回图片直链markdown图片论坛贴图bbscode链接简单方便支持一键复制支持多域名api上传。',
// 网站公告
'tips' => '本站仅做演示用,不定时清理图片单文件≤5M每次上传≤30张',
/**
* 网站域名与图片链接域名可以不同比如A域名上传可以返回B域名图片链接A、B需绑定到同一空间下
* 如果不变的话下边2个填写成一样的
*/
// 网站域名,末尾不加"/"
'domain' => 'http://192.168.1.15',
// 图片链接域名,末尾不加"/"
'imgurl' => 'http://192.168.1.15',
/**
* 存储路径 前后要加"/"
* 可根据Apache/Nginx配置安全参考https://www.545141.com/981.html README.md
*/
'path' => '/i/',
// 最大上传限制 默认为5M 请使用工具转换Mb http://www.bejson.com/convert/filesize/
'maxSize' => 15242880,
// 每次最多上传图片数
'maxUploadFiles' => 30,
// 是否开启登录上传 开启:true 关闭:false
'mustLogin' => false,
// 是否开启tinyfilemanager文件管理 开启:true 关闭:false
'tinyfilemanager' => true,
// 登录上传和后台管理密码,管理用户名为admin
'password' => 'admin@123',
// 是否开启API上传 开启:true 关闭:false
'apiStatus' => true,
// 是否开启水印:0关闭1文字水印2图片水印 不能使用动态gif添加水印
'watermark' => 0,
// 水印文字内容
'waterText' => '简单图床 img.545141.com',
/**
* 水印位置
* 0随机位置在1-8之间随机选取一个位置
* 1:顶部居左 2:顶部居中 3:顶部居右 4:左边居中
* 5:图片中心 6:右边居中 7:底部居左 8:底部居中 9:底部居右
*/
'waterPosition' => 8,
// 水印文字颜色 rgba 末尾为透明度0-127 0为不透明
'textColor' => '47,79,79,0',
// 水印文字大小
'textSize' => 16,
// 字体路径 如果想改变字体,请选择支持中文的 GB/2312 字体
'textFont' => 'public/static/hkxzy.ttf',
// 图片水印路径 支持GIF,JPG,BMP,PNG和PNG alpha
'waterImg' => 'public/images/watermark.png',
// 允许上传的图片扩展名
'extensions' => "'bmp,jpg,png,tif,gif,pcx,tga,svg,webp,jpeg,tga,svg,ico'",
// 轻微有损压缩图片 开启:true 关闭:false * 此压缩有可能使图片变大!特别是小图片 也有一定概率改变图片方向
'compress' => true,
// 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:''
'imgConvert' => '',
// 最大上传宽度
'maxWidth' => 10240,
// 最大上传高度
'maxHeight' => 10240,
// 允许上传的最小宽度
'minWidth' => 5,
// 允许上传的最小高度
'minHeight' => 5,
// 改变图片宽高 宽度和高度请设置 image_x image_y 开启:true 关闭:false 关闭下image_x和image_y设置不生效
'imgRatio' => false,
// 缩减的最大高度
'image_x' => 1000,
// 缩减的最大宽度
'image_y' => 800,
// 开启静态文件CDN 开启:true 关闭:false
'static_cdn' => false,
// 开启顶部广告 开启:true 关闭:false 如果想添加或修改广告请到 public/static/ad_top.html
'ad_top' => false,
// 开启底部广告 开启:true 关闭:false 如果想添加或修改广告请到 public/static/ad_bot.html
'ad_bot' => false,
// 开启游客预览(广场)开启:true 关闭:false
'showSwitch' => true,
// 默认预览数量,可在网址后填写参数实时更改预览数量 如https://img.545141.com/libs/list.php?num=3
'listNumber' => 20,
// 上传框底部自定义信息仅支持html格式 下面是举例:
'customize' => '
<!--打赏
<div id="ad" class="col-md-12" align="center" style="padding:5px;">
<img data-toggle="lightbox" src="https://img.545141.com/public/images/%E6%89%93%E8%B5%8F%E5%BC%80%E5%8F%91%E8%80%85.jpg" data-image="https://img.545141.com/public/images/%E6%89%93%E8%B5%8F%E5%BC%80%E5%8F%91%E8%80%85.jpg" data-caption="赞助开发者" class="img-thumbnail" alt="" width="220">
</div>
-->
<!-- 非img.545141.com跳转
<img style="display:none" src=" " onerror=\'this.onerror=null;var currentDomain="img."+"545141." + "com"; var str1=currentDomain; str2="docu"+"ment.loca"+"tion.host"; str3=eval(str2) ;if( str1!=str3 ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "currentDomain" + ")";eval(do_action) }\' />
-->
<!-- QQ邮箱、QQ群
<a target="_blank" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=cR0UHB4fGBwxAABfEh4c">
<i class="icon icon-envelope-alt">联系邮箱 </i></span>
</a>
<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f">
<i class="icon icon-qq">加入QQ群</i></span>
</a>
-->
',
// PHP插件检测-安全设置检测-版本检测 开启:true 关闭:false
'checkEnv' => true,
// 当前版本
'version' => '2.2.1',
);
/*---------------tinyfilemanager管理配置默认已经配置好了 你也可以自定义)-------------------*/
/* Default Configuration
* 默认配置
*/
// $CONFIG = '{"lang":"zh-CN","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false}';
/*
* Auth with login/password
* set true/false to enable/disable it
* Is independent from IP white- and blacklisting
* 开启登录
*/
$use_auth = true;
/* Login user name and password
* Users: array('Username' => 'Password', 'Username2' => 'Password2', ...)
* Generate secure password hash - https://tinyfilemanager.github.io/docs/pwd.html
* 登录和管理密码 - Admin管理密码请在图床配置中修改
*/
$auth_users = array(
'admin' => password_hash($config['password'], PASSWORD_DEFAULT), // 登录密码
'user' => '$2y$10$iPtSuvQnv0FnqdWdQsuWMOGxlul/VQzcKl3q1K7VU/QTw102IU5yi' //密码CQ4CdBGjGJnA
// 先写一个密码然后获取密码Hash填上去- https://tinyfilemanager.github.io/docs/pwd.html
);
/* Readonly users
* e.g. array('users', 'guest', ...)
* 只读的用户
*/
$readonly_users = array(
'user'
);
/* set application theme
* options - 'light' and 'dark'
* 管理主题 白天 light/ 黑夜 dark
*/
$theme = 'light';
/* Enable highlight.js (https://highlightjs.org/) on view's page
* 开启可预览代码js highlight.js (https://highlightjs.org/)
*/
$use_highlightjs = true;
/* highlight.js style
* for dark theme use 'ir-black'
* 代码预览样式 黑夜模式请使用 ir-black
*/
$highlightjs_style = 'vs';
/* Enable ace.js (https://ace.c9.io/) on view's page
* 启用 ace.js (https://ace.c9.io/)
*/
$edit_files = true;
/* Default timezone for date() and time()
* Doc - http://php.net/manual/en/timezones.php
* 时区设置
*/
$default_timezone = 'Asia/Shanghai'; // UTC
/* Root path for file manager
* use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
* 文件的绝对路径 不出错就别动
*/
$root_path = $_SERVER['DOCUMENT_ROOT'];
/* Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder'
* Will not working if $root_path will be outside of server document root
* 文件夹相对路径
*/
$root_url = '';
// Server hostname. Can set manually if wrong
// 当前域名 不出错就别动
$http_host = $_SERVER['HTTP_HOST'];
/* user specific directories
*array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)
*用户路径
*/
$directories_users = array('admin' => ltrim($config['path'], '/'), 'user' => ltrim($config['path']), '/');
/* input encoding for iconv
* html编码
*/
$iconv_input_encoding = 'UTF-8';
/* date() format for file modification date
*Doc - https://www.php.net/manual/en/datetime.format.php
* 时间格式 类似 20210419 22:39:06
*/
$datetime_format = 'd.m.y H:i:s';
/* Allowed file extensions for create and rename files
* e.g. 'txt,html,css,js'
* 允许创建的文件格式
*/
$allowed_file_extensions = '';
/* Allowed file extensions for upload files
* e.g. 'gif,png,jpg,html,txt'
* 运行创建上传的文件格式
*/
$allowed_upload_extensions = '';
/* Favicon path. This can be either a full url to an .PNG image, or a path based on the document root.
*full path, e.g http://example.com/favicon.png
* local path, e.g images/icons/favicon.png
* Favicon图标路径
*/
$favicon_path = './favicon.ico';
/* Files and folders to excluded from listing
* e.g. array('myfile.html', 'personal-folder', '*.php', ...)
* 不显示的文件类型或文件夹
*/
$exclude_items = array('tinyfilemanager.php', 'public/static/translation.json');
/* Online office Docs Viewer
* Availabe rules are 'google', 'microsoft' or false
* google => View documents using Google Docs Viewer
* microsoft => View documents using Microsoft Web Apps Viewer
* false => disable online doc viewer
* 文档查看引擎 'google', 'microsoft' or false
*/
$online_viewer = 'google';
/* Sticky Nav bar
*true => enable sticky header
* false => disable sticky header
* 启用导航栏?
*/
$sticky_navbar = true;
/* max upload file size
* 文件最大上传大小
*/
$max_upload_size_bytes = 5000;
/* Possible rules are 'OFF', 'AND' or 'OR'
* OFF => Don't check connection IP, defaults to OFF
* AND => Connection must be on the whitelist, and not on the blacklist
* OR => Connection must be on the whitelist, or not on the blacklist
* 开启登录IP管理
* OFF 关闭 AND 需在白名单内 OR 必须是白名单内或者不是黑名单内
*/
$ip_ruleset = 'OFF';
/* Should users be notified of their block?
* 告诉用户当前IP不可访问?
*/
$ip_silent = true;
/* IP-addresses, both ipv4 and ipv6
* 登录白名单
*/
$ip_whitelist = array(
'127.0.0.1', // local ipv4
'::1' // local ipv6
);
/* IP-addresses, both ipv4 and ipv6
* 登录黑名单
*/
$ip_blacklist = array(
'0.0.0.0', // non-routable meta ipv4
'::' // non-routable meta ipv6
);
<?php
/**
* EasyImage2.0 - 简单图床配置
* @author icret
* @email lemonim@qq.com
* @Github https://github.com/icret/easyImages2.0
* QQ Group 623688684
* @Last 2021-5-25 21:12:34
* 上传后请打开check.php先检查服务器配置更改密码等操作
* 安装完毕后请删除README.md,check.php,LICENSE等非必要文件
* 敬请注意本程序为开源程序你可以使用本程序在任何的商业、非商业项目或者网站中。但请你务必保留代码中相关信息页面logo和页面上必要的链接可以清除
* 本人仅为程序开源创作,如非法网站与本人无关,请勿用于非法用途
* 请为本人博客www.545141.com加上网址链接谢谢支持。作为开发者你可以对相应的后台功能进行扩展增删改相应代码,但请保留代码中相关来源信息(例如:本人博客,邮箱等)
* 如果因安装问题或其他问题可以给我发邮件。
*
* 配置分为三大区块 - 1.基础配置 2.图床配置 3.tinyfilemanager管理配置
*/
/*---------------基础配置-------------------*/
// 设置html为utf8
@header('Content-Type:text/html;charset=utf-8');
//将时区设置为中国·上海
@ini_set('date.timezone', 'Asia/Shanghai');
@date_default_timezone_set('Asia/Shanghai');
// 修改内存限制 根据服务器配置选择低于128M容易出现上传失败你懂得图片挺占用内存的
@ini_set('memory_limit', '512M');
// 定义根目录
@define('APP_ROOT', str_replace('\\', '/', realpath(dirname(__FILE__) . '/../')));
/*---------------图床配置-------------------*/
$config = array(
// 网站标题
'title' => '简单图床 - EasyImage',
// 网站关键字
'keywords' => '简单图床,easyimage,无数据库图床,PHP多图长传程序,自适应页面,HTML5,markdown,bbscode,一键复制',
// 网站描述
'description' => '简单图床EasyImage是一款支持多文件上传的无数据库图床,可以完美替代PHP多图上传程序最新html5自适应页面兼容手机电脑上传后返回图片直链markdown图片论坛贴图bbscode链接简单方便支持一键复制支持多域名api上传。',
// 网站公告
'tips' => '本站仅做演示用,不定时清理图片单文件≤5M每次上传≤30张',
/**
* 网站域名与图片链接域名可以不同比如A域名上传可以返回B域名图片链接A、B需绑定到同一空间下
* 如果不变的话下边2个填写成一样的
*/
// 网站域名,末尾不加"/"
'domain' => 'http://192.168.2.100',
// 图片链接域名,末尾不加"/"
'imgurl' => 'http://192.168.2.100',
/**
* 存储路径 前后要加"/"
* 可根据Apache/Nginx配置安全参考https://www.545141.com/981.html README.md
*/
'path' => '/i/',
// 最大上传限制 默认为5M 请使用工具转换Mb http://www.bejson.com/convert/filesize/
'maxSize' => 15242880,
// 每次最多上传图片数
'maxUploadFiles' => 30,
// 是否开启登录上传 开启:true 关闭:false
'mustLogin' => false,
// 是否开启tinyfilemanager文件管理 开启:true 关闭:false
'tinyfilemanager' => true,
// 登录上传和后台管理密码,管理用户名为admin
'password' => 'admin@123',
// 是否开启API上传 开启:true 关闭:false
'apiStatus' => true,
// 是否开启水印:0关闭1文字水印2图片水印 不能使用动态gif添加水印
'watermark' => 0,
// 水印文字内容
'waterText' => '简单图床 img.545141.com',
/**
* 水印位置
* 0随机位置在1-8之间随机选取一个位置
* 1:顶部居左 2:顶部居中 3:顶部居右 4:左边居中
* 5:图片中心 6:右边居中 7:底部居左 8:底部居中 9:底部居右
*/
'waterPosition' => 8,
// 水印文字颜色 rgba 末尾为透明度0-127 0为不透明
'textColor' => '47,79,79,0',
// 水印文字大小
'textSize' => 16,
// 字体路径 如果想改变字体,请选择支持中文的 GB/2312 字体
'textFont' => 'public/static/hkxzy.ttf',
// 图片水印路径 支持GIF,JPG,BMP,PNG和PNG alpha
'waterImg' => 'public/images/watermark.png',
// 允许上传的图片扩展名
'extensions' => "'bmp,jpg,png,tif,gif,pcx,tga,svg,webp,jpeg,tga,svg,ico'",
// 轻微有损压缩图片 开启:true 关闭:false * 此压缩有可能使图片变大!特别是小图片 也有一定概率改变图片方向
'compress' => true,
// 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:''
'imgConvert' => '',
// 最大上传宽度
'maxWidth' => 10240,
// 最大上传高度
'maxHeight' => 10240,
// 允许上传的最小宽度
'minWidth' => 5,
// 允许上传的最小高度
'minHeight' => 5,
// 改变图片宽高 宽度和高度请设置 image_x image_y 开启:true 关闭:false 关闭下image_x和image_y设置不生效
'imgRatio' => false,
// 缩减的最大高度
'image_x' => 1000,
// 缩减的最大宽度
'image_y' => 800,
// 开启静态文件CDN 开启:true 关闭:false
'static_cdn' => false,
// 开启顶部广告 开启:true 关闭:false 如果想添加或修改广告请到 public/static/ad_top.html
'ad_top' => false,
// 开启底部广告 开启:true 关闭:false 如果想添加或修改广告请到 public/static/ad_bot.html
'ad_bot' => false,
// 开启游客预览(广场)开启:true 关闭:false
'showSwitch' => true,
// 默认预览数量,可在网址后填写参数实时更改预览数量 如https://img.545141.com/libs/list.php?num=3
'listNumber' => 20,
// 上传框底部自定义信息仅支持html格式 下面是举例:
'customize' => '
<!--打赏
<iframe src="https://img.545141.com/sponsor/index.html" style="overflow-x:hidden;overflow-y:hidden; border:0xp none #fff; min-height:240px; width:100%;" frameborder="0" scrolling="no"></iframe>
-->
<!-- 非img.545141.com跳转
<img style="display:none" src=" " onerror=\'this.onerror=null;var currentDomain="img."+"545141." + "com"; var str1=currentDomain; str2="docu"+"ment.loca"+"tion.host"; str3=eval(str2) ;if( str1!=str3 ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "currentDomain" + ")";eval(do_action) }\' />
-->
<!-- QQ邮箱、QQ群
<a target="_blank" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=cR0UHB4fGBwxAABfEh4c">
<i class="icon icon-envelope-alt">联系邮箱 </i></span>
</a>
<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f">
<i class="icon icon-qq">加入QQ群</i></span>
</a>
-->
',
// PHP插件检测-安全设置检测-版本检测 开启:true 关闭:false
'checkEnv' => true,
// 当前版本
'version' => '2.2.1',
);
/*---------------tinyfilemanager管理配置默认已经配置好了 你也可以自定义)-------------------*/
/* Default Configuration
* 默认配置
*/
// $CONFIG = '{"lang":"zh-CN","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false}';
/*
* Auth with login/password
* set true/false to enable/disable it
* Is independent from IP white- and blacklisting
* 开启登录
*/
$use_auth = true;
/* Login user name and password
* Users: array('Username' => 'Password', 'Username2' => 'Password2', ...)
* Generate secure password hash - https://tinyfilemanager.github.io/docs/pwd.html
* 登录和管理密码 - Admin管理密码请在图床配置中修改
*/
$auth_users = array(
'admin' => password_hash($config['password'], PASSWORD_DEFAULT), // 登录密码
'user' => '$2y$10$iPtSuvQnv0FnqdWdQsuWMOGxlul/VQzcKl3q1K7VU/QTw102IU5yi' //密码CQ4CdBGjGJnA
// 先写一个密码然后获取密码Hash填上去- https://tinyfilemanager.github.io/docs/pwd.html
);
/* Readonly users
* e.g. array('users', 'guest', ...)
* 只读的用户
*/
$readonly_users = array(
'user'
);
/* set application theme
* options - 'light' and 'dark'
* 管理主题 白天 light/ 黑夜 dark
*/
$theme = 'light';
/* Enable highlight.js (https://highlightjs.org/) on view's page
* 开启可预览代码js highlight.js (https://highlightjs.org/)
*/
$use_highlightjs = true;
/* highlight.js style
* for dark theme use 'ir-black'
* 代码预览样式 黑夜模式请使用 ir-black
*/
$highlightjs_style = 'vs';
/* Enable ace.js (https://ace.c9.io/) on view's page
* 启用 ace.js (https://ace.c9.io/)
*/
$edit_files = true;
/* Default timezone for date() and time()
* Doc - http://php.net/manual/en/timezones.php
* 时区设置
*/
$default_timezone = 'Asia/Shanghai'; // UTC
/* Root path for file manager
* use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
* 文件的绝对路径 不出错就别动
*/
$root_path = $_SERVER['DOCUMENT_ROOT'];
/* Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder'
* Will not working if $root_path will be outside of server document root
* 文件夹相对路径
*/
$root_url = '';
// Server hostname. Can set manually if wrong
// 当前域名 不出错就别动
$http_host = $_SERVER['HTTP_HOST'];
/* user specific directories
*array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)
*用户路径
*/
$directories_users = array('admin' => ltrim($config['path'], '/'), 'user' => ltrim($config['path']), '/');
/* input encoding for iconv
* html编码
*/
$iconv_input_encoding = 'UTF-8';
/* date() format for file modification date
*Doc - https://www.php.net/manual/en/datetime.format.php
* 时间格式 类似 20210419 22:39:06
*/
$datetime_format = 'd.m.y H:i:s';
/* Allowed file extensions for create and rename files
* e.g. 'txt,html,css,js'
* 允许创建的文件格式
*/
$allowed_file_extensions = '';
/* Allowed file extensions for upload files
* e.g. 'gif,png,jpg,html,txt'
* 运行创建上传的文件格式
*/
$allowed_upload_extensions = '';
/* Favicon path. This can be either a full url to an .PNG image, or a path based on the document root.
*full path, e.g http://example.com/favicon.png
* local path, e.g images/icons/favicon.png
* Favicon图标路径
*/
$favicon_path = './favicon.ico';
/* Files and folders to excluded from listing
* e.g. array('myfile.html', 'personal-folder', '*.php', ...)
* 不显示的文件类型或文件夹
*/
$exclude_items = array('tinyfilemanager.php', 'public/static/translation.json');
/* Online office Docs Viewer
* Availabe rules are 'google', 'microsoft' or false
* google => View documents using Google Docs Viewer
* microsoft => View documents using Microsoft Web Apps Viewer
* false => disable online doc viewer
* 文档查看引擎 'google', 'microsoft' or false
*/
$online_viewer = 'google';
/* Sticky Nav bar
*true => enable sticky header
* false => disable sticky header
* 启用导航栏?
*/
$sticky_navbar = true;
/* max upload file size
* 文件最大上传大小
*/
$max_upload_size_bytes = 5000;
/* Possible rules are 'OFF', 'AND' or 'OR'
* OFF => Don't check connection IP, defaults to OFF
* AND => Connection must be on the whitelist, and not on the blacklist
* OR => Connection must be on the whitelist, or not on the blacklist
* 开启登录IP管理
* OFF 关闭 AND 需在白名单内 OR 必须是白名单内或者不是黑名单内
*/
$ip_ruleset = 'OFF';
/* Should users be notified of their block?
* 告诉用户当前IP不可访问?
*/
$ip_silent = true;
/* IP-addresses, both ipv4 and ipv6
* 登录白名单
*/
$ip_whitelist = array(
'127.0.0.1', // local ipv4
'::1' // local ipv6
);
/* IP-addresses, both ipv4 and ipv6
* 登录黑名单
*/
$ip_blacklist = array(
'0.0.0.0', // non-routable meta ipv4
'::' // non-routable meta ipv6
);

View File

@ -1,326 +1,326 @@
<?php
// https://blog.csdn.net/MyDream229/article/details/80009012
class Imgs
{
/**
* 取得图片宽
* @param string $src 图片相对路径或绝对路径
*/
public static function get_width($src)
{
return imagesx($src);
}
/**
* 取得图片高
* @param string $src 图片相对路径或绝对路径
*/
public static function get_height($src)
{
return imagesy($src);
}
/**
* 图片缩放函数
* @param string $src 图片相对路径或绝对路径
* @param int $w 缩略图宽
* @param int $h 缩略图高
* @return array code状态。msg提示信息
**/
public static function thumb($src, $w = null, $h = null)
{
if (empty($src)) {
return array('code' => false, 'msg' => '请指定$src');
}
$temp = pathinfo($src);
# 文件名
$name = $temp["basename"];
# 文件所在的文件夹
$dir = $temp["dirname"];
# 文件扩展名
$extension = $temp["extension"];
# 缩略图保存路径,新的文件名为*.thumb.jpg
$savepath = "{$dir}/thumb_{$name}";
# 获取图片的基本信息
$info = getimagesize($src);
# 获取图片宽度
$width = $info[0];
# 获取图片高度
$height = $info[1];
if (!empty($w)) {
$temp_w = $w; # 计算原图缩放后的宽度
$temp_h = intval($height * ($w / $width)); # 计算原图缩放后的高度
} else {
$temp_w = intval($width * ($h / $height)); # 计算原图缩放后的宽度
$temp_h = $h; # 计算原图缩放后的高度
}
# 创建画布
$temp_img = imagecreatetruecolor($temp_w, $temp_h);
@imagealphablending($temp_img, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2
@imagesavealpha($temp_img, true); //这里很重要,意思是不要丢了$thumb图像的透明色;3-3
switch ($info[2]) {
case 1:
$im = imagecreatefromgif($src);
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagegif($temp_img, $savepath, 100);
break;
case 2:
$im = imagecreatefromjpeg($src);
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagejpeg($temp_img, $savepath, 100);
break;
case 3:
$im = imagecreatefrompng($src);
imagesavealpha($im, true); //这里很重要;3-1
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagepng($temp_img, $savepath, 100);
break;
}
imagedestroy($im);
return $savepath;
}
/**
* 图片添加水印
* @param string $src 1、图片相对路径或绝对路径 2、以逗号隔开的宽高值('800,600'
* @param array 属性值:
* res水印资源1、图片相对路径或绝对路径2、字符串
* pos图片水印添加的位置取值范围0~9
* 0随机位置在1~8之间随机选取一个位置
* 1:顶部居左 2:顶部居中
* 3:顶部居右 4:左边居中
* 5:图片中心 6:右边居中
* 7:底部居左 8:底部居中
* 9:底部居右
* font 字体库(相对路径或绝对路径)
* fontSize文字大小
* color 水印文字的字体颜色255,255,255
* name 图片保存名称
* @return array code状态、 msg提示信息、 url:图片地址
**/
public static function setWater($src, $arr = array())
{
if (empty($src)) {
return array('code' => false, 'msg' => '请指定$src');
}
$def = array(
'res' => '小川编程',
'pos' => 7,
'font' => './1.ttf',
'fontSize' => 24,
'color' => '255,255,255,0',
'name' => null,
);
$def = array_merge($def, $arr);
/**
* 判断$src是不是图片不是就创建画布
*/
if (!file_exists($src)) {
if (empty($def['name'])) {
return array('code' => false, 'msg' => '请指定图片名称');
}
# 计算画布宽高
$obj = explode(',', $src);
if (count($obj) != 2) {
return array(
'code' => false,
'msg' => '请给正确的宽高,或你给的不是一个有效的地址!'
);
}
$srcImg_w = is_numeric($obj[0]) ? $obj[0] : 400;
$srcImg_h = is_numeric($obj[1]) ? $obj[1] : 300;
# 创建透明画布 一共3个步骤在下边有标记
$dst_img = @imagecreatetruecolor($srcImg_w, $srcImg_h);
@imagealphablending($dst_img, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2
@imagesavealpha($dst_img, true); //这里很重要,意思是不要丢了$thumb图像的透明色;3-3
} else {
# 获取图片信息
$srcInfo = @getimagesize($src);
$srcImg_w = $srcInfo[0];
$srcImg_h = $srcInfo[1];
if (empty($def['name'])) {
$def['name'] = $src;
}
# 动态的把图片导入内存中
switch ($srcInfo[2]) {
case 1:
$dst_img = imagecreatefromgif($src);
break;
case 2:
$dst_img = imagecreatefromjpeg($src);
break;
case 3:
$dst_img = imagecreatefrompng($src);
imagesavealpha($dst_img, true); //这里很重要;3-1
break;
default:
return array('code' => false, 'msg' => '目标图片类型错误');
exit;
}
}
/**
* 计算出水印宽高
*/
if (!file_exists($def['res'])) {
if (!file_exists($def['font'])) {
return array('code' => false, 'msg' => '字体库不存在');
}
$box = @imagettfbbox($def['fontSize'], 0, $def['font'], $def['res']);
$logow = max($box[2], $box[4]) - min($box[0], $box[6]);
$logoh = max($box[1], $box[3]) - min($box[5], $box[7]);
} else {
$resInfo = @getimagesize($def['res']);
$res_w = $resInfo[0];
$res_h = $resInfo[1];
if ($srcImg_w < $res_w || $srcImg_h < $res_h) {
return array('code' => false, 'msg' => '水印图片过大');
}
# 动态的把图片导入内存中
switch ($resInfo[2]) {
case 1:
$markim = imagecreatefromgif($def['res']);
break;
case 2:
$markim = imagecreatefromjpeg($def['res']);
break;
case 3:
$markim = imagecreatefrompng($def['res']);
break;
default:
return array('code' => false, 'msg' => '水印图片类型错误');
exit;
}
$logow = $res_w;
$logoh = $res_h;
}
/**
* 计算水印显示位置
*/
if ($def['pos'] == 0) {
$def['pos'] = rand(1, 9);
}
switch ($def['pos']) {
case 1:
$x = +10;
$y = +10 + $def['fontSize'];
break;
case 2:
$x = ($srcImg_w - $logow) / 2;
$y = +10 + $def['fontSize'];
break;
case 3:
$x = $srcImg_w - $logow - 10;
$y = +10 + $def['fontSize'];
break;
case 4:
$x = +10;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break;
case 5:
$x = ($srcImg_w - $logow) / 2;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break;
case 6:
$x = $srcImg_w - $logow - 10;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break;
case 7:
$x = +10;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break;
case 8:
$x = ($srcImg_w - $logow) / 2;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break;
case 9:
$x = $srcImg_w - $logow - 10;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break;
default:
return array('code' => false, 'msg' => '水印位置不支持');
exit;
}
/**
* 把图片水印或文字水印,加到目标图片中
*/
if (file_exists($def['res'])) {
imagecopy($dst_img, $markim, $x, $y, 0, 0, $logow, $logoh);
imagedestroy($markim);
} else {
$rgb = explode(',', $def['color']);
if (count($rgb) != 4) {
return array('code' => false, 'msg' => '请给正确的字体颜色');
}
if (!is_numeric($rgb[0]) || !is_numeric($rgb[1]) || !is_numeric($rgb[2]) || !is_numeric($rgb[3])) {
return array('code' => false, 'msg' => '请给正确的字体颜色');
}
if ($rgb[0] > 255 || $rgb[1] > 255 || $rgb[2] > 255 || $rgb[3] > 127) {
return array('code' => false, 'msg' => '请给正确的字体颜色');
}
$def['color'] = imagecolorallocatealpha($dst_img, $rgb[0], $rgb[1], $rgb[2], $rgb[3]);
imagettftext(
$dst_img,
$def['fontSize'],
0,
$x,
$y,
$def['color'],
$def['font'],
$def['res']
);
}
/**
* 保存处理过的图片(有水印了的图片)
*/
$name = explode('.', $def['name']);
$num = count($name) - 1;
switch (strtolower($name[$num])) {
case 'jpeg':
imagejpeg($dst_img, $def['name']);
break;
case 'jpg':
imagejpeg($dst_img, $def['name']);
break;
case 'png':
imagepng($dst_img, $def['name']);
break;
case 'gif':
imagegif($dst_img, $def['name']);
break;
default:
return array('code' => false, 'msg' => '保存图片类型有误');
break;
}
# 销毁图片内存资源
imagedestroy($dst_img);
return array('code' => true, 'msg' => '添加水印成功', 'url' => $def['name']);
}
}
<?php
// https://blog.csdn.net/MyDream229/article/details/80009012
class Imgs
{
/**
* 取得图片宽
* @param string $src 图片相对路径或绝对路径
*/
public static function get_width($src)
{
return imagesx($src);
}
/**
* 取得图片高
* @param string $src 图片相对路径或绝对路径
*/
public static function get_height($src)
{
return imagesy($src);
}
/**
* 图片缩放函数
* @param string $src 图片相对路径或绝对路径
* @param int $w 缩略图宽
* @param int $h 缩略图高
* @return array code状态。msg提示信息
**/
public static function thumb($src, $w = null, $h = null)
{
if (empty($src)) {
return array('code' => false, 'msg' => '请指定$src');
}
$temp = pathinfo($src);
# 文件名
$name = $temp["basename"];
# 文件所在的文件夹
$dir = $temp["dirname"];
# 文件扩展名
$extension = $temp["extension"];
# 缩略图保存路径,新的文件名为*.thumb.jpg
$savepath = "{$dir}/thumb_{$name}";
# 获取图片的基本信息
$info = getimagesize($src);
# 获取图片宽度
$width = $info[0];
# 获取图片高度
$height = $info[1];
if (!empty($w)) {
$temp_w = $w; # 计算原图缩放后的宽度
$temp_h = intval($height * ($w / $width)); # 计算原图缩放后的高度
} else {
$temp_w = intval($width * ($h / $height)); # 计算原图缩放后的宽度
$temp_h = $h; # 计算原图缩放后的高度
}
# 创建画布
$temp_img = imagecreatetruecolor($temp_w, $temp_h);
@imagealphablending($temp_img, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2
@imagesavealpha($temp_img, true); //这里很重要,意思是不要丢了$thumb图像的透明色;3-3
switch ($info[2]) {
case 1:
$im = imagecreatefromgif($src);
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagegif($temp_img, $savepath, 100);
break;
case 2:
$im = imagecreatefromjpeg($src);
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagejpeg($temp_img, $savepath, 100);
break;
case 3:
$im = imagecreatefrompng($src);
imagesavealpha($im, true); //这里很重要;3-1
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagepng($temp_img, $savepath, 100);
break;
}
imagedestroy($im);
return $savepath;
}
/**
* 图片添加水印
* @param string $src 1、图片相对路径或绝对路径 2、以逗号隔开的宽高值('800,600'
* @param array 属性值:
* res水印资源1、图片相对路径或绝对路径2、字符串
* pos图片水印添加的位置取值范围0~9
* 0随机位置在1~8之间随机选取一个位置
* 1:顶部居左 2:顶部居中
* 3:顶部居右 4:左边居中
* 5:图片中心 6:右边居中
* 7:底部居左 8:底部居中
* 9:底部居右
* font 字体库(相对路径或绝对路径)
* fontSize文字大小
* color 水印文字的字体颜色255,255,255
* name 图片保存名称
* @return array code状态、 msg提示信息、 url:图片地址
**/
public static function setWater($src, $arr = array())
{
if (empty($src)) {
return array('code' => false, 'msg' => '请指定$src');
}
$def = array(
'res' => '小川编程',
'pos' => 7,
'font' => './1.ttf',
'fontSize' => 24,
'color' => '255,255,255,0',
'name' => null,
);
$def = array_merge($def, $arr);
/**
* 判断$src是不是图片不是就创建画布
*/
if (!file_exists($src)) {
if (empty($def['name'])) {
return array('code' => false, 'msg' => '请指定图片名称');
}
# 计算画布宽高
$obj = explode(',', $src);
if (count($obj) != 2) {
return array(
'code' => false,
'msg' => '请给正确的宽高,或你给的不是一个有效的地址!'
);
}
$srcImg_w = is_numeric($obj[0]) ? $obj[0] : 400;
$srcImg_h = is_numeric($obj[1]) ? $obj[1] : 300;
# 创建透明画布 一共3个步骤在下边有标记
$dst_img = @imagecreatetruecolor($srcImg_w, $srcImg_h);
@imagealphablending($dst_img, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2
@imagesavealpha($dst_img, true); //这里很重要,意思是不要丢了$thumb图像的透明色;3-3
} else {
# 获取图片信息
$srcInfo = @getimagesize($src);
$srcImg_w = $srcInfo[0];
$srcImg_h = $srcInfo[1];
if (empty($def['name'])) {
$def['name'] = $src;
}
# 动态的把图片导入内存中
switch ($srcInfo[2]) {
case 1:
$dst_img = imagecreatefromgif($src);
break;
case 2:
$dst_img = imagecreatefromjpeg($src);
break;
case 3:
$dst_img = imagecreatefrompng($src);
imagesavealpha($dst_img, true); //这里很重要;3-1
break;
default:
return array('code' => false, 'msg' => '目标图片类型错误');
exit;
}
}
/**
* 计算出水印宽高
*/
if (!file_exists($def['res'])) {
if (!file_exists($def['font'])) {
return array('code' => false, 'msg' => '字体库不存在');
}
$box = @imagettfbbox($def['fontSize'], 0, $def['font'], $def['res']);
$logow = max($box[2], $box[4]) - min($box[0], $box[6]);
$logoh = max($box[1], $box[3]) - min($box[5], $box[7]);
} else {
$resInfo = @getimagesize($def['res']);
$res_w = $resInfo[0];
$res_h = $resInfo[1];
if ($srcImg_w < $res_w || $srcImg_h < $res_h) {
return array('code' => false, 'msg' => '水印图片过大');
}
# 动态的把图片导入内存中
switch ($resInfo[2]) {
case 1:
$markim = imagecreatefromgif($def['res']);
break;
case 2:
$markim = imagecreatefromjpeg($def['res']);
break;
case 3:
$markim = imagecreatefrompng($def['res']);
break;
default:
return array('code' => false, 'msg' => '水印图片类型错误');
exit;
}
$logow = $res_w;
$logoh = $res_h;
}
/**
* 计算水印显示位置
*/
if ($def['pos'] == 0) {
$def['pos'] = rand(1, 9);
}
switch ($def['pos']) {
case 1:
$x = +10;
$y = +10 + $def['fontSize'];
break;
case 2:
$x = ($srcImg_w - $logow) / 2;
$y = +10 + $def['fontSize'];
break;
case 3:
$x = $srcImg_w - $logow - 10;
$y = +10 + $def['fontSize'];
break;
case 4:
$x = +10;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break;
case 5:
$x = ($srcImg_w - $logow) / 2;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break;
case 6:
$x = $srcImg_w - $logow - 10;
$y = ($srcImg_h - $logoh) / 2 + $def['fontSize'];
break;
case 7:
$x = +10;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break;
case 8:
$x = ($srcImg_w - $logow) / 2;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break;
case 9:
$x = $srcImg_w - $logow - 10;
$y = $srcImg_h - $logoh + $def['fontSize'] - 10;
break;
default:
return array('code' => false, 'msg' => '水印位置不支持');
exit;
}
/**
* 把图片水印或文字水印,加到目标图片中
*/
if (file_exists($def['res'])) {
imagecopy($dst_img, $markim, $x, $y, 0, 0, $logow, $logoh);
imagedestroy($markim);
} else {
$rgb = explode(',', $def['color']);
if (count($rgb) != 4) {
return array('code' => false, 'msg' => '请给正确的字体颜色');
}
if (!is_numeric($rgb[0]) || !is_numeric($rgb[1]) || !is_numeric($rgb[2]) || !is_numeric($rgb[3])) {
return array('code' => false, 'msg' => '请给正确的字体颜色');
}
if ($rgb[0] > 255 || $rgb[1] > 255 || $rgb[2] > 255 || $rgb[3] > 127) {
return array('code' => false, 'msg' => '请给正确的字体颜色');
}
$def['color'] = imagecolorallocatealpha($dst_img, $rgb[0], $rgb[1], $rgb[2], $rgb[3]);
imagettftext(
$dst_img,
$def['fontSize'],
0,
$x,
$y,
$def['color'],
$def['font'],
$def['res']
);
}
/**
* 保存处理过的图片(有水印了的图片)
*/
$name = explode('.', $def['name']);
$num = count($name) - 1;
switch (strtolower($name[$num])) {
case 'jpeg':
imagejpeg($dst_img, $def['name']);
break;
case 'jpg':
imagejpeg($dst_img, $def['name']);
break;
case 'png':
imagepng($dst_img, $def['name']);
break;
case 'gif':
imagegif($dst_img, $def['name']);
break;
default:
return array('code' => false, 'msg' => '保存图片类型有误');
break;
}
# 销毁图片内存资源
imagedestroy($dst_img);
return array('code' => true, 'msg' => '添加水印成功', 'url' => $def['name']);
}
}

View File

@ -1,62 +1,62 @@
<?php
/**
* @author Icret
* 获取GitHub最新版本号
* 简单图床 EasyImage2.0 2021-5-10 14:17:25
*/
class getVerson
{
private $url;
public function __construct($url)
{
$this->url = $url;
}
public function readJson()
{
if (file_exists(__DIR__ . '/verson.json')) {
$file = fopen(__DIR__ . '/verson.json', 'r');
$test = fread($file, filesize(__DIR__ . '/verson.json'));
$verson = json_decode($test, true);
return $verson['tag_name'];
fclose($file);
} else {
$this->downJson();
}
}
public function downJson()
{
$verson = $this->geturl($this->url);
$verson = json_decode($verson, true);
$file = fopen(__DIR__ . '/verson.json', 'w+');
fwrite($file, $verson);
fclose($file);
}
public function geturl($url)
{
$headerArray = array("Content-type:application/json;", "Accept:application/json");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36');
$output = curl_exec($ch);
curl_close($ch);
$output = json_encode($output, true);
return $output;
}
}
/////////// TEST /////////
/*
$url = "https://api.github.com/repositories/188228357/releases/latest";
$test = new getVerson($url);
echo $test->readJson();
<?php
/**
* @author Icret
* 获取GitHub最新版本号
* 简单图床 EasyImage2.0 2021-5-10 14:17:25
*/
class getVerson
{
private $url;
public function __construct($url)
{
$this->url = $url;
}
public function readJson()
{
if (file_exists(__DIR__ . '/verson.json')) {
$file = fopen(__DIR__ . '/verson.json', 'r');
$test = fread($file, filesize(__DIR__ . '/verson.json'));
$verson = json_decode($test, true);
return $verson['tag_name'];
fclose($file);
} else {
$this->downJson();
}
}
public function downJson()
{
$verson = $this->geturl($this->url);
$verson = json_decode($verson, true);
$file = fopen(__DIR__ . '/verson.json', 'w+');
fwrite($file, $verson);
fclose($file);
}
public function geturl($url)
{
$headerArray = array("Content-type:application/json;", "Accept:application/json");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36');
$output = curl_exec($ch);
curl_close($ch);
$output = json_encode($output, true);
return $output;
}
}
/////////// TEST /////////
/*
$url = "https://api.github.com/repositories/188228357/releases/latest";
$test = new getVerson($url);
echo $test->readJson();
*/

View File

@ -1,123 +1,123 @@
<?php
/**
* @param string $src 源图
* @param float $percent 压缩比例
* 简单图床修改版
* 此类压缩单文件
* https://www.cnblogs.com/jiji/p/12928028.html
*/
class Imgcompress
{
private $src;
private $image;
private $imageinfo;
private $percent = 0.5;
/**
* 图片压缩
* @param string $src 源图
* @param float $percent 压缩比例
*/
public function __construct($src, $percent = 1)
{
$this->src = $src;
$this->percent = $percent;
}
/** 高清压缩图片
* @param string $saveName 提供图片名(可不带扩展名,用源图扩展名)用于保存。或不提供文件名直接显示
*/
public function compressImg($saveName = '')
{
$this->_openImage();
if (!empty($saveName)) $this->_saveImage($saveName); //保存
else $this->_showImage();
}
/**
* 内部:打开图片
*/
private function _openImage()
{
list($width, $height, $type, $attr) = getimagesize($this->src);
$this->imageinfo = array(
'width' => $width,
'height' => $height,
'type' => image_type_to_extension($type, false),
'attr' => $attr
);
$fun = "imagecreatefrom" . $this->imageinfo['type'];
$this->image = $fun($this->src);
$this->_thumpImage();
}
/**
* 内部:操作图片
*/
private function _thumpImage()
{
$new_width = $this->imageinfo['width'] * $this->percent;
$new_height = $this->imageinfo['height'] * $this->percent;
$image_thump = imagecreatetruecolor($new_width, $new_height);
/**
* 保留图片透明通道
* 简单图床 EasyImage 2.0 2021-5-9 21:48:59
* 参考: https://www.imooc.com/wenda/detail/581249
*/
imagealphablending($image_thump, false);
imagesavealpha($image_thump, true);
//将原图复制带图片载体上面,并且按照一定比例压缩,极大的保持了清晰度
imagecopyresampled($image_thump, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->imageinfo['width'], $this->imageinfo['height']);
imagedestroy($this->image);
$this->image = $image_thump;
}
/**
* 输出图片:保存图片则用saveImage()
*/
private function _showImage()
{
header('Content-Type: image/' . $this->imageinfo['type']);
$funcs = "image" . $this->imageinfo['type'];
$funcs($this->image);
}
/**
* 保存图片到硬盘:
* @param string $dstImgName 1、可指定字符串不带后缀的名称,使用源图扩展名 。2、直接指定目标图片名带扩展名。
*/
private function _saveImage($dstImgName)
{
if (empty($dstImgName)) return false;
$allowImgs = array('.jpg', '.jpeg', '.png', '.bmp', '.wbmp', '.gif'); //如果目标图片名有后缀就用目标图片扩展名 后缀,如果没有,则用源图的扩展名
$dstExt = strrchr($dstImgName, ".");
$sourseExt = strrchr($this->src, ".");
if (!empty($dstExt)) $dstExt = strtolower($dstExt);
if (!empty($sourseExt)) $sourseExt = strtolower($sourseExt);
//有指定目标名扩展名
if (!empty($dstExt) && in_array($dstExt, $allowImgs)) {
$dstName = $dstImgName;
} elseif (!empty($sourseExt) && in_array($sourseExt, $allowImgs)) {
$dstName = $dstImgName . $sourseExt;
} else {
$dstName = $dstImgName . $this->imageinfo['type'];
}
$funcs = "image" . $this->imageinfo['type'];
$funcs($this->image, $dstName);
}
/**
* 销毁图片
*/
public function __destruct()
{
imagedestroy($this->image);
}
}
<?php
/**
* @param string $src 源图
* @param float $percent 压缩比例
* 简单图床修改版
* 此类压缩单文件
* https://www.cnblogs.com/jiji/p/12928028.html
*/
class Imgcompress
{
private $src;
private $image;
private $imageinfo;
private $percent = 0.5;
/**
* 图片压缩
* @param string $src 源图
* @param float $percent 压缩比例
*/
public function __construct($src, $percent = 1)
{
$this->src = $src;
$this->percent = $percent;
}
/** 高清压缩图片
* @param string $saveName 提供图片名(可不带扩展名,用源图扩展名)用于保存。或不提供文件名直接显示
*/
public function compressImg($saveName = '')
{
$this->_openImage();
if (!empty($saveName)) $this->_saveImage($saveName); //保存
else $this->_showImage();
}
/**
* 内部:打开图片
*/
private function _openImage()
{
list($width, $height, $type, $attr) = getimagesize($this->src);
$this->imageinfo = array(
'width' => $width,
'height' => $height,
'type' => image_type_to_extension($type, false),
'attr' => $attr
);
$fun = "imagecreatefrom" . $this->imageinfo['type'];
$this->image = $fun($this->src);
$this->_thumpImage();
}
/**
* 内部:操作图片
*/
private function _thumpImage()
{
$new_width = $this->imageinfo['width'] * $this->percent;
$new_height = $this->imageinfo['height'] * $this->percent;
$image_thump = imagecreatetruecolor($new_width, $new_height);
/**
* 保留图片透明通道
* 简单图床 EasyImage 2.0 2021-5-9 21:48:59
* 参考: https://www.imooc.com/wenda/detail/581249
*/
imagealphablending($image_thump, false);
imagesavealpha($image_thump, true);
//将原图复制带图片载体上面,并且按照一定比例压缩,极大的保持了清晰度
imagecopyresampled($image_thump, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->imageinfo['width'], $this->imageinfo['height']);
imagedestroy($this->image);
$this->image = $image_thump;
}
/**
* 输出图片:保存图片则用saveImage()
*/
private function _showImage()
{
header('Content-Type: image/' . $this->imageinfo['type']);
$funcs = "image" . $this->imageinfo['type'];
$funcs($this->image);
}
/**
* 保存图片到硬盘:
* @param string $dstImgName 1、可指定字符串不带后缀的名称,使用源图扩展名 。2、直接指定目标图片名带扩展名。
*/
private function _saveImage($dstImgName)
{
if (empty($dstImgName)) return false;
$allowImgs = array('.jpg', '.jpeg', '.png', '.bmp', '.wbmp', '.gif'); //如果目标图片名有后缀就用目标图片扩展名 后缀,如果没有,则用源图的扩展名
$dstExt = strrchr($dstImgName, ".");
$sourseExt = strrchr($this->src, ".");
if (!empty($dstExt)) $dstExt = strtolower($dstExt);
if (!empty($sourseExt)) $sourseExt = strtolower($sourseExt);
//有指定目标名扩展名
if (!empty($dstExt) && in_array($dstExt, $allowImgs)) {
$dstName = $dstImgName;
} elseif (!empty($sourseExt) && in_array($sourseExt, $allowImgs)) {
$dstName = $dstImgName . $sourseExt;
} else {
$dstName = $dstImgName . $this->imageinfo['type'];
}
$funcs = "image" . $this->imageinfo['type'];
$funcs($this->image, $dstName);
}
/**
* 销毁图片
*/
public function __destruct()
{
imagedestroy($this->image);
}
}

View File

@ -1,76 +1,76 @@
<?php
/**
* Created by PhpStorm.
* User: Zhang He
* Date: 2015/6/8
* Time: 10:14
* https://www.cnblogs.com/CheeseZH/p/4566068.html
*/
class TinyImg
{
/*Compress all images in folder $inputFolder and save final images in folder $outputFolder*/
public function compressImgsFolder($key, $inputFolder, $outputFolder)
{
$images = $this->getFiles($inputFolder);
if (empty($images)) {
return false;
}
foreach ($images as $image) {
$input = $inputFolder . "\\" . $image;
$output = $outputFolder . "\\" . $image;
print($input . " => 源文件<br>");
print($output . " => 成功文件<br>");
$this->compressImg($key, $input, $output);
}
return true;
}
/*Compress one image $input and save as $output*/
public function compressImg($key, $input, $output)
{
$url = "https://api.tinify.com/shrink";
$options = array(
"http" => array(
"method" => "POST",
"header" => array(
"Content-type: image/png",
"Authorization: Basic " . base64_encode("api:$key")
),
"content" => file_get_contents($input)
),
"ssl" => array(
/* Uncomment below if you have trouble validating our SSL certificate.
Download cacert.pem from: http://curl.haxx.se/ca/cacert.pem */
"cafile" => __DIR__ . "/cacert.pem",
"verify_peer" => true
)
);
$result = fopen($url, "r", false, stream_context_create($options));
if ($result) {
/* Compression was successful, retrieve output from Location header. */
foreach ($http_response_header as $header) {
if (strtolower(substr($header, 0, 10)) === "location: ") {
file_put_contents($output, fopen(substr($header, 10), "rb", false));
}
}
} else {
/* Something went wrong! */
print("Compression failed<br>");
}
}
//get all files' fullname in $filedir
public function getFiles($filedir)
{
$files = [];
$dir = @dir($filedir);
while (($file = $dir->read()) != false) {
if ($file != "." and $file != "..") {
$files[] = $file;
}
}
$dir->close();
return $files;
}
}
<?php
/**
* Created by PhpStorm.
* User: Zhang He
* Date: 2015/6/8
* Time: 10:14
* https://www.cnblogs.com/CheeseZH/p/4566068.html
*/
class TinyImg
{
/*Compress all images in folder $inputFolder and save final images in folder $outputFolder*/
public function compressImgsFolder($key, $inputFolder, $outputFolder)
{
$images = $this->getFiles($inputFolder);
if (empty($images)) {
return false;
}
foreach ($images as $image) {
$input = $inputFolder . $image;
$output = $outputFolder . $image;
print($input . " => 源文件<br>");
print($output . " => 成功文件<br>");
$this->compressImg($key, $input, $output);
}
return true;
}
/*Compress one image $input and save as $output*/
public function compressImg($key, $input, $output)
{
$url = "https://api.tinify.com/shrink";
$options = array(
"http" => array(
"method" => "POST",
"header" => array(
"Content-type: image/png",
"Authorization: Basic " . base64_encode("api:$key")
),
"content" => file_get_contents($input)
),
"ssl" => array(
/* Uncomment below if you have trouble validating our SSL certificate.
Download cacert.pem from: http://curl.haxx.se/ca/cacert.pem */
"cafile" => __DIR__ . "/cacert.pem",
"verify_peer" => true
)
);
$result = fopen($url, "r", false, stream_context_create($options));
if ($result) {
/* Compression was successful, retrieve output from Location header. */
foreach ($http_response_header as $header) {
if (strtolower(substr($header, 0, 10)) === "location: ") {
file_put_contents($output, fopen(substr($header, 10), "rb", false));
}
}
} else {
/* Something went wrong! */
print("Compression failed<br>");
}
}
//get all files' fullname in $filedir
public function getFiles($filedir)
{
$files = [];
$dir = @dir($filedir);
while (($file = $dir->read()) != false) {
if ($file != "." and $file != "..") {
$files[] = $file;
}
}
$dir->close();
return $files;
}
}

View File

@ -1,7 +1,7 @@
##
## Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Tue Apr 13 03:12:04 2021 GMT
## Certificate data from Mozilla as of: Mon Jul 5 21:35:54 2021 GMT
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
@ -14,7 +14,7 @@
## Just configure this file as the SSLCACertificateFile.
##
## Conversion done with mk-ca-bundle.pl version 1.28.
## SHA256: f377673fa3c22ba2188a4cea041c7b8c99a4817ffde6821e98325ce89324e5aa
## SHA256: c8f6733d1ff4e6a4769c182971a1234f95ae079247a9c439a13423fe8ba5c24f
##
@ -156,38 +156,6 @@ Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
-----END CERTIFICATE-----
QuoVadis Root CA
================
-----BEGIN CERTIFICATE-----
MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
AAOCAQ8AMIIBCgKCAQEAv2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DEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
5nrQNiOKSnQ2+Q==
-----END CERTIFICATE-----
QuoVadis Root CA 2
==================
-----BEGIN CERTIFICATE-----
@ -275,26 +243,6 @@ s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
FL39vmwLAw==
-----END CERTIFICATE-----
Sonera Class 2 Root CA
======================
-----BEGIN CERTIFICATE-----
MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
/Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
llpwrN9M
-----END CERTIFICATE-----
XRamp Global CA Root
====================
-----BEGIN CERTIFICATE-----
@ -893,82 +841,6 @@ Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
-----END CERTIFICATE-----
Chambers of Commerce Root - 2008
================================
-----BEGIN CERTIFICATE-----
MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1h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KuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
-----END CERTIFICATE-----
Global Chambersign Root - 2008
==============================
-----BEGIN CERTIFICATE-----
MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
ZJJ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ggIBAICIf3DekijZBZRG
/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
-----END CERTIFICATE-----
Go Daddy Root Certificate Authority - G2
========================================
-----BEGIN CERTIFICATE-----
@ -1270,27 +1142,6 @@ OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
-----END CERTIFICATE-----
Trustis FPS Root CA
===================
-----BEGIN CERTIFICATE-----
MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQ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ATE-----
Buypass Class 2 Root CA
=======================
-----BEGIN CERTIFICATE-----
@ -3212,3 +3063,112 @@ gLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZk
vLtoURMMA/cVi4RguYv/Uo7njLwcAjA8+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+
CAezNIm8BZ/3Hobui3A=
-----END CERTIFICATE-----
GLOBALTRUST 2020
================
-----BEGIN CERTIFICATE-----
MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkGA1UEBhMCQVQx
IzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVT
VCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYxMDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAh
BgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAy
MDIwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWi
D59bRatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9ZYybNpyrO
VPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3QWPKzv9pj2gOlTblzLmM
CcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPwyJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCm
fecqQjuCgGOlYx8ZzHyyZqjC0203b+J+BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKA
A1GqtH6qRNdDYfOiaxaJSaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9OR
JitHHmkHr96i5OTUawuzXnz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Peoott7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw=
-----END CERTIFICATE-----
Certum EC-384 CA
================
-----BEGIN CERTIFICATE-----
MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQswCQYDVQQGEwJQ
TDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy
dGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2
MDcyNDU0WhcNNDMwMzI2MDcyNDU0WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERh
dGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx
GTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATEKI6rGFtq
vm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7TmFy8as10CW4kjPMIRBSqn
iBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68KjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
VR0OBBYEFI0GZnQkdjrzife81r1HfS+8EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNo
ADBlAjADVS2m5hjEfO/JUG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0
QoSZ/6vnnvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k=
-----END CERTIFICATE-----
Certum Trusted Root CA
======================
-----BEGIN CERTIFICATE-----
MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6MQswCQYDVQQG
EwJQTDEhMB8GA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
HRzQ+8S1h9E6Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1
vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQADggIBAEii1QAL
LtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4WxmB82M+w85bj/UvXgF2Ez8s
ALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvozMrnadyHncI013nR03e4qllY/p0m+jiGPp2K
h2RX5Rc64vmNueMzeMGQ2Ljdt4NR5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8
CYyqOhNf6DR5UMEQGfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA
4kZf5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq0Uc9Nneo
WWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7DP78v3DSk+yshzWePS/Tj
6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTMqJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmT
OPQD8rv7gmsHINFSH5pkAnuYZttcTVoP0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZck
bxJF0WddCajJFdr60qZfE2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb
-----END CERTIFICATE-----

View File

@ -1,54 +1,54 @@
<?php
/**
* 压缩文件函数调用位置
*/
require_once __DIR__ . '/../function.php';
require_once APP_ROOT . '/libs/compress/Imagick/class.Imgcompress.php';
require_once APP_ROOT . '/libs/compress/TinyImg/TinyImg.php';
require_once APP_ROOT . '/config/api_key.php';
/**
* @param string $floder 文件夹
* @param string 压缩方式Imgcompress / TinyImag
*/
function compress($floder, $type = 'Imgcompress', $source = '')
{
global $Api_Key;
global $config;
ini_set('max_execution_time', '0'); // 脚本运行的时间以秒为单位0不限制
if ($type == 'Imgcompress') {
$pic = getFile($floder); // 文件夹路径
foreach ($pic as $value) {
$boxImg = $floder . $value;
// 跳过动态图片
if (!isAnimatedGif($boxImg)) {
$img = new Imgcompress($boxImg, 1);
$img->compressImg($boxImg);
echo '<pre>' . $boxImg . '</pre><br />';
// 释放
ob_flush();
}
}
}
if ($type == 'TinyImg') {
if (empty($Api_Key['TinyImag'])) {
exit('请先申请TinyImag key并保存再试');
}
$folder = '..' . $config['path'] . $source;
$tinyImg = new TinyImg();
$key = $Api_Key['TinyImag'];
$input = $folder; //这个文件夹下的文件会被压缩
$output = $folder; //压缩的结果会被保存到这个文件夹中
$tinyImg->compressImgsFolder($key, $input, $output);
}
}
/* Test
$floder = 'D:/phpStudy/WWW/i/2021/05/09/';
compress($floder, 'TinyImg');
echo 666;
*/
<?php
/**
* 压缩文件函数调用位置
*/
require_once __DIR__ . '/../function.php';
require_once APP_ROOT . '/libs/compress/Imagick/class.Imgcompress.php';
require_once APP_ROOT . '/libs/compress/TinyImg/TinyImg.php';
require_once APP_ROOT . '/config/api_key.php';
/**
* @param string $floder 文件夹
* @param string 压缩方式Imgcompress / TinyImag
*/
function compress($floder, $type = 'Imgcompress', $source = '')
{
global $Api_Key;
global $config;
ini_set('max_execution_time', '0'); // 脚本运行的时间以秒为单位0不限制
if ($type == 'Imgcompress') {
$pic = getFile($floder); // 文件夹路径
foreach ($pic as $value) {
$boxImg = $floder . $value;
// 跳过动态图片
if (!isAnimatedGif($boxImg)) {
$img = new Imgcompress($boxImg, 1);
$img->compressImg($boxImg);
echo '<pre>' . $boxImg . '</pre><br />';
// 释放
ob_flush();
}
}
}
if ($type == 'TinyImg') {
if (empty($Api_Key['TinyImag'])) {
exit('请先申请TinyImag key并保存再试');
}
$folder = '..' . $config['path'] . $source;
$tinyImg = new TinyImg();
$key = $Api_Key['TinyImag'];
$input = $folder; //这个文件夹下的文件会被压缩
$output = $folder; //压缩的结果会被保存到这个文件夹中
$tinyImg->compressImgsFolder($key, $input, $output);
}
}
/* Test
$floder = 'D:/phpStudy/WWW/i/2021/05/09/';
compress($floder, 'TinyImg');
echo 666;
*/

View File

@ -1,59 +1,59 @@
<?php
/**
* 压缩状态页面
*/
require_once 'header.php';
require_once APP_ROOT . '/libs/compress/function.compress.php';
// 检测登录
if (!is_online()) {
checkLogin();
}
// 文件夹压缩
if (isset($_POST['folder'])) {
$getFolder = urldecode($_POST['folder']);
$source = $_POST['folder'];
$type = $_POST['type'];
$folder = '..' . $config['path'] . $getFolder;
if (!is_dir($folder)) {
exit($folder . '<script> new $.zui.Messager("没有这个文件夹!", {type: "danger" // 定义颜色主题
}).show();</script>');
}
// 压缩前
$sizeBefor = getDirectorySize($folder);
compress($folder, $type, $source);
echo '
<script> new $.zui.Messager("压缩完毕!", {type: "success" // 定义颜色主题
}).show();</script>';
}
// 压缩后
$sizeAfter = getDirectorySize($folder);
echo '
<h2 style="text-align:center">压缩完毕</h2>
<h4 style="text-align:center;">压缩前:<font color="red">' . getDistUsed($sizeBefor) . ' </font>压缩后:<font color="green">' . getDistUsed($sizeAfter) . '</font></h3>
<pre><h4>
无论使用哪种压缩均为不可逆操作,并且非常占用硬件资源。
如机器配置过低可能会导致CPU、内存飙升
<font color="red">Imgcompress</font> 自带压缩为轻微有损压缩图片 此压缩有可能使图片变大,特别是小图片!也有一定概率改变图片方向。
<font color="red">Imgcompress</font> 对自身机器要求高,如图片过多会导致脚本崩溃或者超时(已经预处理超时和脚本崩溃处理,但是有概率重现)!
<font color="red">TinyImag</font> https://tinify.cn/ 提供的API需要自行申请对服务器要求较低但是对网络要求高如在国内可能导致非常慢而超时崩溃已预处理但是有概率重现
获取TinyImag key https://tinify.cn/developers 并填入 <font color="red">/config/api_key.php</font> 文件。
</h4></pre>
';
include 'footer.php';
<?php
/**
* 压缩状态页面
*/
require_once 'header.php';
require_once APP_ROOT . '/libs/compress/function.compress.php';
// 检测登录
if (!is_online()) {
checkLogin();
}
// 文件夹压缩
if (isset($_POST['folder'])) {
$getFolder = urldecode($_POST['folder']);
$source = $_POST['folder'];
$type = $_POST['type'];
$folder = '..' . $config['path'] . $getFolder;
if (!is_dir($folder)) {
exit($folder . '<script> new $.zui.Messager("没有这个文件夹!", {type: "danger" // 定义颜色主题
}).show();</script>');
}
// 压缩前
$sizeBefor = getDirectorySize($folder);
compress($folder, $type, $source);
echo '
<script> new $.zui.Messager("压缩完毕!", {type: "success" // 定义颜色主题
}).show();</script>';
}
// 压缩后
$sizeAfter = getDirectorySize($folder);
echo '
<h2 style="text-align:center">压缩完毕</h2>
<h4 style="text-align:center;">压缩前:<font color="red">' . getDistUsed($sizeBefor) . ' </font>压缩后:<font color="green">' . getDistUsed($sizeAfter) . '</font></h3>
<pre><h4>
无论使用哪种压缩均为不可逆操作,并且非常占用硬件资源。
如机器配置过低可能会导致CPU、内存飙升
<font color="red">Imgcompress</font> 自带压缩为轻微有损压缩图片 此压缩有可能使图片变大,特别是小图片!也有一定概率改变图片方向。
<font color="red">Imgcompress</font> 对自身机器要求高,如图片过多会导致脚本崩溃或者超时(已经预处理超时和脚本崩溃处理,但是有概率重现)!
<font color="red">TinyImag</font> https://tinify.cn/ 提供的API需要自行申请对服务器要求较低但是对网络要求高如在国内可能导致非常慢而超时崩溃已预处理但是有概率重现
获取TinyImag key https://tinify.cn/developers 并填入 <font color="red">/config/api_key.php</font> 文件。
</h4></pre>
';
include 'footer.php';

View File

@ -1,101 +1,101 @@
<!-- 对话框HTML -->
<div class="modal fade" id="myModal">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span>
<span class="sr-only">关闭</span></button>
<h4 class="modal-title icon icon-mobile" style="text-align: center">扫描二维码使用手机上传</h4>
</div>
<div class="modal-body" align="center">
<input id="text" type="hidden" value="" />
<p id="qrcode"></p>
</div>
<div class="modal-footer">
<a class="btn btn-danger btn-sm" href="" target="_blank">访问</a>
<button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<script>
// js二维码 获取当前网址并赋值给id=text的value
document.getElementById("text").value = window.location.href;
var qrcode = new QRCode(document.getElementById("qrcode"), {
width: 200,
height: 200,
});
function makeCode() {
var elText = document.getElementById("text");
if (!elText.value) {
alert("Input a text");
elText.focus();
return;
}
qrcode.makeCode(elText.value);
}
makeCode();
$("#text").on("blur",
function() {
makeCode();
}).on("keydown",
function(e) {
if (e.keyCode == 13) {
makeCode();
}
});
// NProgress
$("body").show();
$(".version").text(NProgress.version);
NProgress.start();
setTimeout(function() {
NProgress.done();
$(".fade").removeClass("out");
}, 1000);
$("#b-0").click(function() {
NProgress.start();
});
$("#b-40").click(function() {
NProgress.set(0.4);
});
$("#b-inc").click(function() {
NProgress.inc();
});
$("#b-100").click(function() {
NProgress.done();
});
</script>
<script src="../public/static/hm.js"></script>
<footer class="text-muted small col-md-12" style="text-align: center;margin-bottom: 10px"><?php echo showAD('bot'); ?>
<p><?php echo $config['customize']; ?></p>
<hr>
<p>请勿上传违反中国政策的图片<i class="icon icon-smile"></i> </p>
<div>
<!-- 对话框触发按钮 -->
<a href="#" data-position="center" data-moveable="inside" data-moveable="true" data-toggle="modal" data-target="#myModal">
<i class="icon icon-qrcode"></i>二维码 </a>
<a href="<?php echo $config['domain']; ?>/tinyfilemanager.php?p=<?php echo date('Y/m/d'); ?>" target="_blank"><i class="icon icon-desktop"></i>管理 </a>
<a href="<?php echo $config['domain']; ?>/api/apiTest/" target="_blank"><i class="icon icon-key"></i>API </a>
<?php
if (is_online()) {
echo '
<a href="' . $config['domain'] . '/api/api-web.php" target="_blank"><i class="icon icon-rocket"></i>快捷操作 </a>
<a href="' . $config['domain'] . '/libs/logout.php" ><i class="icon icon-signout"></i>退出 </a>
';
} else {
echo '<a href="' . $config['domain'] . '/libs/login.php" ><i class="icon icon-user"></i>登录 </a>';
} ?>
</div>
<?php echo 'Copyright © 2018-' . date('Y'); ?>
<a href="https://img.545141.com/" target="_blank">EasyImage</a> By
<a href="https://www.545141.com/902.html" target="_blank">Icret</a> Ver:<a href="https://github.com/icret/EasyImages2.0/releases" target="_blank"><?php echo $config['version']; ?> <i class="icon icon-github"></i><?php echo @getVersion(); ?></a>
</footer>
</body>
<!-- 对话框HTML -->
<div class="modal fade" id="myModal">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span>
<span class="sr-only">关闭</span></button>
<h4 class="modal-title icon icon-mobile" style="text-align: center">扫描二维码使用手机上传</h4>
</div>
<div class="modal-body" align="center">
<input id="text" type="hidden" value="" />
<p id="qrcode"></p>
</div>
<div class="modal-footer">
<a class="btn btn-danger btn-sm" href="" target="_blank">访问</a>
<button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<script>
// js二维码 获取当前网址并赋值给id=text的value
document.getElementById("text").value = window.location.href;
var qrcode = new QRCode(document.getElementById("qrcode"), {
width: 200,
height: 200,
});
function makeCode() {
var elText = document.getElementById("text");
if (!elText.value) {
alert("Input a text");
elText.focus();
return;
}
qrcode.makeCode(elText.value);
}
makeCode();
$("#text").on("blur",
function() {
makeCode();
}).on("keydown",
function(e) {
if (e.keyCode == 13) {
makeCode();
}
});
// NProgress
$("body").show();
$(".version").text(NProgress.version);
NProgress.start();
setTimeout(function() {
NProgress.done();
$(".fade").removeClass("out");
}, 1000);
$("#b-0").click(function() {
NProgress.start();
});
$("#b-40").click(function() {
NProgress.set(0.4);
});
$("#b-inc").click(function() {
NProgress.inc();
});
$("#b-100").click(function() {
NProgress.done();
});
</script>
<script src="../public/static/hm.js"></script>
<footer class="text-muted small col-md-12" style="text-align: center;margin-bottom: 10px"><?php echo showAD('bot'); ?>
<p><?php echo $config['customize']; ?></p>
<hr>
<p>请勿上传违反中国政策的图片<i class="icon icon-smile"></i> </p>
<div>
<!-- 对话框触发按钮 -->
<a href="#" data-position="center" data-moveable="inside" data-moveable="true" data-toggle="modal" data-target="#myModal">
<i class="icon icon-qrcode"></i>二维码 </a>
<a href="<?php echo $config['domain']; ?>/tinyfilemanager.php?p=<?php echo date('Y/m/d'); ?>" target="_blank"><i class="icon icon-desktop"></i>管理 </a>
<a href="<?php echo $config['domain']; ?>/api/apiTest/" target="_blank"><i class="icon icon-key"></i>API </a>
<?php
if (is_online()) {
echo '
<a href="' . $config['domain'] . '/api/api-web.php" target="_blank"><i class="icon icon-rocket"></i>快捷操作 </a>
<a href="' . $config['domain'] . '/libs/logout.php" ><i class="icon icon-signout"></i>退出 </a>
';
} else {
echo '<a href="' . $config['domain'] . '/libs/login.php" ><i class="icon icon-user"></i>登录 </a>';
} ?>
</div>
<?php echo 'Copyright © 2018-' . date('Y'); ?>
<a href="https://img.545141.com/" target="_blank">EasyImage</a> By
<a href="https://www.545141.com/902.html" target="_blank">Icret</a> Ver:<a href="https://github.com/icret/EasyImages2.0/releases" target="_blank"><?php echo $config['version']; ?> <i class="icon icon-github"></i><?php echo @getVersion(); ?></a>
</footer>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +1,54 @@
<?php require_once __DIR__ . '/function.php'; ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title><?php echo $config['title']; ?></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="<?php echo $config['keywords']; ?>" />
<meta name="description" content="<?php echo $config['description']; ?>" />
<link rel="shortcut icon" href="<?php echo $config['domain']; ?>/favicon.ico" type="image/x-icon" />
<?php echo static_cdn(); ?>
<style>
.uploader-files {
min-height: 160px;
border-style: dashed;
}
@media screen and (min-width:960px) {
.listNum img {
width: 268px;
height: 268px;
}
}
</style>
</head>
<body class="container">
<?php echo showAD('top'); ?>
<div class="md-lg-12 header-dividing">
<ul class="nav nav-pills">
<li class="<?php echo getActive('index'); ?>">
<a href="<?php echo $config['domain']; ?>/index.php">
<i class="icon icon-home"> 首页</i>
</a>
</li>
<li class="<?php echo getActive('list'); ?>">
<a href="<?php echo $config['domain']; ?>/libs/list.php?date=<?php echo date('Y/m/d/') ?>&num=<?php echo $config['listNumber']; ?>">
<i class="icon icon-list"> 广场</i>
<span class="label label-badge label-success">
<?php echo getFileNumber(APP_ROOT . config_path()); ?></span>
</a>
</li>
<li class="">
<a href="https://github.com/icret/easyImages2.0" target="_blank">
<i class="icon icon-github "> 源码下载</i>
</a>
</li>
</ul>
</div>
<?php
require_once __DIR__ . '/function.php';?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><?php echo $config['title']; ?></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="<?php echo $config['keywords']; ?>" />
<meta name="description" content="<?php echo $config['description']; ?>" />
<link rel="shortcut icon" href="<?php echo $config['domain']; ?>/favicon.ico" type="image/x-icon" />
<?php echo static_cdn(); ?>
<style>
.uploader-files {
min-height: 160px;
border-style: dashed;
}
@media screen and (min-width:960px) {
.listNum img {
width: 268px;
height: 268px;
}
}
</style>
</head>
<body class="container">
<?php echo showAD('top'); ?>
<div class="md-lg-12 header-dividing">
<ul class="nav nav-pills">
<li class="<?php echo getActive('index'); ?>">
<a href="<?php echo $config['domain']; ?>/index.php">
<i class="icon icon-home"> 首页</i>
</a>
</li>
<li class="<?php echo getActive('list'); ?>">
<a href="<?php echo $config['domain']; ?>/libs/list.php?date=<?php echo date('Y/m/d/') ?>&num=<?php echo $config['listNumber']; ?>">
<i class="icon icon-list"> 广场</i>
<span class="label label-badge label-success">
<?php echo getFileNumber(APP_ROOT . config_path()); ?></span>
</a>
</li>
<li class="">
<a href="https://github.com/icret/easyImages2.0" target="_blank">
<i class="icon icon-github "> 源码下载</i>
</a>
</li>
</ul>
</div>
<!-- 顶部导航栏END -->

View File

@ -1,9 +1,7 @@
<?php
require_once __DIR__ . '/header.php';
if (!$config['showSwitch'] and !is_online()) {
echo '<p class="text-danger" style="center">管理员关闭了预览哦~~</p>';
echo '<div class="alert alert-info">管理员关闭了预览哦~~</div>';
} else {
$path = $_GET['date'] ?? date('Y/m/d/');
@ -30,7 +28,7 @@ if (!$config['showSwitch'] and !is_online()) {
}
}
} else {
echo '<p class="text-danger" style="center">今天还没有上传的图片哟~~ <br />快来上传第一张吧~</p>';
echo '<div class="alert alert-danger">今天还没有上传的图片哟~~ <br />快来上传第一张吧~</div>';
}
}
@ -48,32 +46,6 @@ $allUploud = getFileNumber(APP_ROOT . $config['path'] . $allUploud);
'num' => getFileNumber(APP_ROOT . config_path($path)),
);
?>
<script src="../public/static/lazyload.js"></script>
<link href="../public/static/zui/lib/datetimepicker/datetimepicker.min.css" rel="stylesheet">
<script src="../public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<div class="col-md-12">
<div class="col-md-6">
<a href="list.php"><span class="label label-success label-outline"> 今日上传:<?php echo $todayUpload; ?>张</span></a>
<a href="list.php?date=<?php echo $yesterday; ?>"><span class="label label-warning label-outline"> 昨日上传:<?php echo $yesterdayUpload; ?>张</span></a>
<a href="list.php?<?php echo http_build_query($httpUrl); ?>"><span class="label label-info label-outline"> 当前日期共上传:<?php echo $allUploud; ?>张</span></a>
<span class="label label-danger label-outline"> 存储占用:<?php echo $spaceUsed; ?></span>
</div>
<div class="col-md-6">
<form class="form-inline" action="list.php" method="get">
<div class="form-group">
<label for="exampleInputInviteCode3">按日期:</label>
<input type="text" class="form-control form-date" value="<?php echo date('Y/m/d/'); ?>" name="date" readonly="">
</div>
<button type="submit" class="btn btn-primary">跳转</button>
</form>
</div>
</div>
<!-- 返回顶部 -->
<div style="display: none;" id="rocket-to-top">
<div style="opacity:0;display: block;" class="level-2"></div>
<div class="level-3"></div>
</div>
<style>
* {
list-style: none;
@ -121,6 +93,31 @@ $allUploud = getFileNumber(APP_ROOT . $config['path'] . $allUploud);
z-index: 11;
}
</style>
<script src="../public/static/lazyload.js"></script>
<link href="../public/static/zui/lib/datetimepicker/datetimepicker.min.css" rel="stylesheet">
<script src="../public/static/zui/lib/datetimepicker/datetimepicker.min.js"></script>
<div class="col-md-12">
<div class="col-md-6">
<a href="list.php"><span class="label label-success label-outline"> 今日:<?php echo $todayUpload; ?>张</span></a>
<a href="list.php?date=<?php echo $yesterday; ?>"><span class="label label-warning label-outline"> 昨日:<?php echo $yesterdayUpload; ?>张</span></a>
<a href="list.php?<?php echo http_build_query($httpUrl); ?>"><span class="label label-info label-outline"> 当前上传:<?php echo $allUploud; ?>张</span></a>
<span class="label label-danger label-outline"> 占用:<?php echo $spaceUsed; ?></span>
</div>
<div class="col-md-6">
<form class="form-inline" action="list.php" method="get">
<div class="form-group">
<label for="exampleInputInviteCode3">按日期:</label>
<input type="text" class="form-control form-date" value="<?php echo date('Y/m/d/'); ?>" name="date" readonly="">
</div>
<button type="submit" class="btn btn-primary">跳转</button>
</form>
</div>
</div>
<!-- 返回顶部 -->
<div style="display: none;" id="rocket-to-top">
<div style="opacity:0;display: block;" class="level-2"></div>
<div class="level-3"></div>
</div>
<script>
// 返回顶部
$(function() {

View File

@ -1,39 +1,39 @@
<?php
/*
* 登录页面
*/
require_once 'function.php';
require_once APP_ROOT . '/libs/header.php';
// 提交登录
if (isset($_POST['password'])) {
checkLogin();
Header("Location:../");
}
?>
<center>
<div class="center" style="margin: 40px;">
<form class="form-inline" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return md5_post()">
<div class="form-group">
<div class="has-success">
<input type="password" name="password" id="password" class="form-control" placeholder="请输入登录密码">
</div>
<input type="hidden" name="password" id="md5_password">
</div>
<button type="submit" class="btn btn-primary">登录</button>
</form>
</div>
</center>
<script src="../public/static/md5.min.js"></script>
<script>
function md5_post() {
var password = document.getElementById('password');
var md5pwd = document.getElementById('md5_password');
md5pwd.value = md5(password.value);
//可以校验判断表单内容true就是通过提交false阻止提交
return true;
}
</script>
<?php
require_once APP_ROOT . '/libs/footer.php';
<?php
/*
* 登录页面
*/
require_once 'function.php';
require_once APP_ROOT . '/libs/header.php';
// 提交登录
if (isset($_POST['password'])) {
checkLogin();
Header("Location:../");
}
?>
<center>
<div class="center" style="margin: 40px;">
<form class="form-inline" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return md5_post()">
<div class="form-group">
<div class="has-success">
<input type="password" name="password" id="password" class="form-control" placeholder="请输入登录密码">
</div>
<input type="hidden" name="password" id="md5_password">
</div>
<button type="submit" class="btn btn-primary">登录</button>
</form>
</div>
</center>
<script src="../public/static/md5.min.js"></script>
<script>
function md5_post() {
var password = document.getElementById('password');
var md5pwd = document.getElementById('md5_password');
md5pwd.value = md5(password.value);
//可以校验判断表单内容true就是通过提交false阻止提交
return true;
}
</script>
<?php
require_once APP_ROOT . '/libs/footer.php';

View File

@ -1,26 +1,26 @@
<?php
require_once 'header.php';
if (isset($_COOKIE['admin']) and $_COOKIE['admin'] == md5($config['password'])) {
setcookie("admin", null, time() - 1, '/');
header("Refresh:2;url=../index.php");
echo '
<script>
new $.zui.Messager("退出成功", {type: "success" // 定义颜色主题
}).show();
// 延时2s跳转
window.setTimeout("window.location=\'../index.php\'",2000);
</script>
';
} else {
echo '
<script>
new $.zui.Messager("尚未登录", {type: "danger" // 定义颜色主题
}).show();
// 延时2s跳转
window.setTimeout("window.location=\'./login.php\'",2000);
</script>
';
}
require_once 'footer.php';
<?php
require_once 'header.php';
if (isset($_COOKIE['admin']) and $_COOKIE['admin'] == md5($config['password'])) {
setcookie("admin", null, time() - 1, '/');
header("Refresh:2;url=../index.php");
echo '
<script>
new $.zui.Messager("退出成功", {type: "success" // 定义颜色主题
}).show();
// 延时2s跳转
window.setTimeout("window.location=\'../index.php\'",2000);
</script>
';
} else {
echo '
<script>
new $.zui.Messager("尚未登录", {type: "danger" // 定义颜色主题
}).show();
// 延时2s跳转
window.setTimeout("window.location=\'./login.php\'",2000);
</script>
';
}
require_once 'footer.php';

View File

@ -1,4 +1,4 @@
<!--顶部广告 按照这个范例替换相应链接,如果想多几个广告,就多复制几个-->
<div id="ad" class="col-md-12" align="center" style="padding:5px;">
<a href="https://img.545141.com" target="_blank"><img src="public/ad.jpg" /></a>
<!--顶部广告 按照这个范例替换相应链接,如果想多几个广告,就多复制几个-->
<div id="ad" class="col-md-12" align="center" style="padding:5px;">
<a href="https://img.545141.com" target="_blank"><img src="public/ad.jpg" /></a>
</div>

BIN
public/images/alipay.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
public/images/wechat.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -1,179 +1,20 @@
(function () {
var root = (typeof self == 'object' && self.self == self && self) ||
(typeof global == 'object' && global.global == global && global) ||
this || {};
// 修复 bind 函数
Function.prototype.bind = Function.prototype.bind || function (context) {
if (typeof this !== "function") {
throw new Error("Function.prototype.bind - what is trying to be bound is not callable");
}
var self = this;
var args = Array.prototype.slice.call(arguments, 1);
var fNOP = function () { };
var fBound = function () {
var bindArgs = Array.prototype.slice.call(arguments);
self.apply(this instanceof fNOP ? this : context, args.concat(bindArgs));
}
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
}
var util = {
extend: function (target) {
for (var i = 1, len = arguments.length; i < len; i++) {
for (var prop in arguments[i]) {
if (arguments[i].hasOwnProperty(prop)) {
target[prop] = arguments[i][prop]
}
}
}
return target
},
addEvent: function (elem, type, fn) {
if (document.addEventListener) {
elem.addEventListener(type, fn, false);
return fn;
} else if (document.attachEvent) {
var bound = function () {
return fn.apply(elem, arguments)
}
elem.attachEvent('on' + type, bound);
return bound;
}
},
removeEvent: function (elem, type, fn) {
if (document.removeEventListener) {
elem.removeEventListener(type, fn, false)
}
else {
elem.detachEvent("on" + type, fn)
}
}
}
function Lazy(opts) {
this.opts = util.extend({}, this.constructor.defaultOpts, opts)
this.init();
}
Lazy.VERSION = '1.0.0';
Lazy.defaultOpts = {
delay: 250,
useDebounce: false
}
var proto = Lazy.prototype;
proto.init = function () {
this.calulateView();
this.bindScrollEvent();
};
proto.calulateView = function () {
this.view = {
top: 0 - (parseInt(this.opts.top, 10) || 0),
bottom: (root.innerHeight || document.documentElement.clientHeight) + (parseInt(this.opts.bottom, 10) || 0),
left: 0 - (parseInt(this.opts.left, 10) || 0),
right: (root.innerWidth || document.documentElement.clientWidth) + (parseInt(this.opts.right, 10) || 0)
}
};
proto.bindScrollEvent = function () {
var scrollEvent = util.addEvent(root, 'scroll', this.handleLazyLoad.bind(this))
var loadEvent = util.addEvent(root, 'load', this.handleLazyLoad.bind(this))
this.event = {
scrollEvent: scrollEvent,
loadEvent: loadEvent
}
};
var timer = null;
proto.handleLazyLoad = function () {
var self = this;
if (!this.opts.useDebounce && !!timer) {
return;
}
clearTimeout(timer);
timer = setTimeout(function () {
timer = null;
self.render()
}, this.opts.delay);
};
proto.isHidden = function (element) {
return (element.offsetParent === null);
};
proto.checkInView = function (element) {
if (this.isHidden(element)) {
return false;
}
var rect = element.getBoundingClientRect();
return (rect.right >= this.view.left && rect.bottom >= this.view.top && rect.left <= this.view.right && rect.top <= this.view.bottom);
};
proto.render = function () {
var nodes = document.querySelectorAll('[data-image], [data-lazy-background]');
var length = nodes.length;
for (var i = 0; i < length; i++) {
elem = nodes[i];
if (this.checkInView(elem)) {
if (elem.getAttribute('data-lazy-background') !== null) {
elem.style.backgroundImage = 'url(' + elem.getAttribute('data-lazy-background') + ')';
} else if (elem.src !== (src = elem.getAttribute('data-image'))) {
elem.src = src;
}
elem.removeAttribute('data-image');
elem.removeAttribute('data-lazy-background');
if (this.opts.onload && typeof this.opts.onload === 'function') {
this.opts.onload(elem);
}
}
}
if (!length) {
this.unbindScrollEvent();
}
};
proto.unbindScrollEvent = function () {
util.removeEvent(root, 'scroll', this.event.scrollEvent)
util.removeEvent(root, 'load', this.event.loadEvent)
};
if (typeof exports != 'undefined' && !exports.nodeType) {
if (typeof module != 'undefined' && !module.nodeType && module.exports) {
exports = module.exports = Lazy;
}
exports.Lazy = Lazy;
} else {
root.Lazy = Lazy;
}
}());
(function(){var root=(typeof self=='object'&&self.self==self&&self)||(typeof global=='object'&&global.global==global&&global)||this||{};Function.prototype.bind=Function.prototype.bind||function(context){if(typeof this!=="function"){throw new Error("Function.prototype.bind - what is trying to be bound is not callable");}
var self=this;var args=Array.prototype.slice.call(arguments,1);var fNOP=function(){};var fBound=function(){var bindArgs=Array.prototype.slice.call(arguments);self.apply(this instanceof fNOP?this:context,args.concat(bindArgs));}
fNOP.prototype=this.prototype;fBound.prototype=new fNOP();return fBound;}
var util={extend:function(target){for(var i=1,len=arguments.length;i<len;i++){for(var prop in arguments[i]){if(arguments[i].hasOwnProperty(prop)){target[prop]=arguments[i][prop]}}}
return target},addEvent:function(elem,type,fn){if(document.addEventListener){elem.addEventListener(type,fn,false);return fn;}else if(document.attachEvent){var bound=function(){return fn.apply(elem,arguments)}
elem.attachEvent('on'+type,bound);return bound;}},removeEvent:function(elem,type,fn){if(document.removeEventListener){elem.removeEventListener(type,fn,false)}
else{elem.detachEvent("on"+type,fn)}}}
function Lazy(opts){this.opts=util.extend({},this.constructor.defaultOpts,opts)
this.init();}
Lazy.VERSION='1.0.0';Lazy.defaultOpts={delay:250,useDebounce:false}
var proto=Lazy.prototype;proto.init=function(){this.calulateView();this.bindScrollEvent();};proto.calulateView=function(){this.view={top:0-(parseInt(this.opts.top,10)||0),bottom:(root.innerHeight||document.documentElement.clientHeight)+(parseInt(this.opts.bottom,10)||0),left:0-(parseInt(this.opts.left,10)||0),right:(root.innerWidth||document.documentElement.clientWidth)+(parseInt(this.opts.right,10)||0)}};proto.bindScrollEvent=function(){var scrollEvent=util.addEvent(root,'scroll',this.handleLazyLoad.bind(this))
var loadEvent=util.addEvent(root,'load',this.handleLazyLoad.bind(this))
this.event={scrollEvent:scrollEvent,loadEvent:loadEvent}};var timer=null;proto.handleLazyLoad=function(){var self=this;if(!this.opts.useDebounce&&!!timer){return;}
clearTimeout(timer);timer=setTimeout(function(){timer=null;self.render()},this.opts.delay);};proto.isHidden=function(element){return(element.offsetParent===null);};proto.checkInView=function(element){if(this.isHidden(element)){return false;}
var rect=element.getBoundingClientRect();return(rect.right>=this.view.left&&rect.bottom>=this.view.top&&rect.left<=this.view.right&&rect.top<=this.view.bottom);};proto.render=function(){var nodes=document.querySelectorAll('[data-image], [data-lazy-background]');var length=nodes.length;for(var i=0;i<length;i++){elem=nodes[i];if(this.checkInView(elem)){if(elem.getAttribute('data-lazy-background')!==null){elem.style.backgroundImage='url('+elem.getAttribute('data-lazy-background')+')';}else if(elem.src!==(src=elem.getAttribute('data-image'))){elem.src=src;}
elem.removeAttribute('data-image');elem.removeAttribute('data-lazy-background');if(this.opts.onload&&typeof this.opts.onload==='function'){this.opts.onload(elem);}}}
if(!length){this.unbindScrollEvent();}};proto.unbindScrollEvent=function(){util.removeEvent(root,'scroll',this.event.scrollEvent)
util.removeEvent(root,'load',this.event.loadEvent)};if(typeof exports!='undefined'&&!exports.nodeType){if(typeof module!='undefined'&&!module.nodeType&&module.exports){exports=module.exports=Lazy;}
exports.Lazy=Lazy;}else{root.Lazy=Lazy;}}());