pull/18/head
icret 2021-05-08 14:45:29 +08:00
parent 6b65bf579d
commit dbfd1285c2
86 changed files with 207 additions and 117 deletions

View File

@ -28,18 +28,15 @@
#### 注意:
1. 安装之前先使用浏览器访问check.php检查扩展是否都安装
2. 使用前请注意先修改config.php中的domain域名。
3. 请将所有文件必须赋予0755权限或者赋予www权限
4. 上传后必须修改config.php的位置
2. 请将所有文件赋予0755权限或www权限
3. 上传后必须修改config.php的位置
- domain 当前图片域名
- password 登录管理密码!
5. 如果无法登陆管理界面或上传图片请先打开check.php检查扩展或者使用phpinfo检查。
6. 可以使用浏览器的 F12调试模式->console查看错误
7. 如果对php不太熟悉的话不要将图床程序放置于二级目录
8. js不要设置分片上传大小此会导致部分图片上传失败。
9. 默认我会给你设置成最优方案api上传默认关闭
10. 下载源码后可以删除一些文件README.md,check.php,LICENSE
11. 欢迎加群:[623688684](https://shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f)
4. 如果无法登陆管理界面或上传图片请先打开check.php检查扩展或者使用phpinfo检查。
5. 可以使用浏览器的 F12调试模式->console查看错误
6. 如果对php不太熟悉的话不要将图床程序放置于二级目录
7. 下载源码后可以删除一些文件README.md,check.php,LICENSE
8. 欢迎加群:[623688684](https://shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f)
#### API上传示例
参数:
@ -60,7 +57,7 @@ html form上传示例:
api上传成功后返回json
```json
参数:"sucess"上传成功 "failed" 上传失败 "url" 图片链接 "del" 删除链接
// 参数:"sucess"上传成功 "url" 图片链接 "del" 删除链接 "failed" 上传失败 "message" 错误信息
{"result":"success","url":"http:\/\/192.168.1.15\/i\/2021\/05\/03\/u34au6_2.jpg","del":"http:\/\/192.168.1.15\/api\/api-web.php?hash=XH%BB2Z%D1%08%D8%E2%D7%048%DFJ%86n%C0%06%DAD%DCP%3E%CF%C4%1B%60%E5%C4Pli"}
```
@ -86,6 +83,15 @@ RewriteRule config/(.*).(php)$ [F]
<details><summary><mark><font color=darkred>点击查看2.0版更新日志</font></mark></summary>
* 2021-5-8 v2.1.1
- 修复上传界面上传失败提示信息bug
- 浏览页面重构
- 删除页面添加登录删除
- 调整首页显示
- 将调整图片长宽放置前端,减小资源开销
- 其他小调整
* 2021-5-2 v2.1
- 将tinyfilemanager配置文件简单翻译并集成到config.php
- 增加底部自定义信息

View File

@ -8,12 +8,18 @@ require_once '../libs/function.php';
/*//////////////////////////////////////////////////////////*/
// 查找token
// 根据token查找用户ID
if (isset($_POST['token'])) {
$getID = '用户ID:' . getID($_POST['token']);
$getID = '用户ID' . getID($_POST['token']);
} else {
$getID = null;
}
// 根据用户ID查找token
if (isset($_POST['id'])) {
$getToken = '用户token' . getIDToken($_POST['id']);
} else {
$getToken = null;
}
// 提交登录
if (isset($_POST['password'])) {
@ -77,6 +83,20 @@ if (!is_online()) {
查找
</button>
</form>
</div>
<div class="col-md-4">
<div id="title" style="margin: 10px;"></div>
<form class="form-condensed" action="' . $_SERVER['PHP_SELF'] . '" method="post">
<div class="form-group">
<label>
根据ID查找用户Token
</label>
<input type="text" name="id" class="form-control" placeholder="请输入用户ID" value="' . $getToken . '">
</div>
<button type="submit" class="btn btn-mini btn-primary">
查找
</button>
</form>
</div>
<div class="col-md-4">
<div id="title" style="margin: 10px;"></div>
@ -87,7 +107,6 @@ if (!is_online()) {
</label>
<input type="url" name="url" class="form-control" id="del" placeholder="请输入图片链接" />
</div>
<button type="submit" class="btn btn-mini btn-primary">
删除
</button>
@ -140,4 +159,23 @@ if (!is_online()) {
}
*/
</script>
<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
if (is_online()) {
foreach ($tokenList as $value) {
echo '<tr><td>' . $value . '</td></tr>';
}
}
?>
</tbody>
</table>
</div>
<?php require_once './../libs/footer.php';

View File

@ -5,6 +5,18 @@
*/
require_once $_SERVER['DOCUMENT_ROOT'] . '/libs/header.php';
require_once '../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-primary">删除</button>
</form>
</div>
';
if (empty($_REQUEST)) {
echo '
<script>
@ -15,10 +27,12 @@ if (empty($_REQUEST)) {
</script>
';
} elseif (isset($_GET['url'])) {
//$img = isset($_GET['hash'])?:$_GET['url'];
$img = $_GET['url'];
//echo '<img data-toggle="lightbox" data-image="' . $img . '" src="' . $img . '" alt="简单图床-EasyImage" class="img-thumbnail">';
echo '<a href="' . $img . '" target="_blank"><img src="' . $img . '" alt="简单图床-EasyImage" class="img-thumbnail"></a>';
echo '
<div class="col-md-12">
<hr />
<a href="' . $img . '" target="_blank"><img src="' . $img . '" alt="简单图床-EasyImage" class="img-thumbnail"></a>
</div>';
}
// 解密删除
@ -47,3 +61,26 @@ if (is_online()) {
}
require_once '../libs/footer.php';
?>
<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() {
oTi.innerHTML = '<img src="' + oBtn.value + '" width="200" class="img-rounded" /><br />';
}
/**
// 动态修改请求地址
function getStr(string, str) {
string = oBtn.value;
str = 'images';
var str_before = string.split(str)[0];
document.delForm.action = str_before + 'del.php';
}
*/
</script>

View File

@ -32,9 +32,21 @@ function getID($token)
global $tokenList;
$token = preg_replace('/[\W]/', '', $token); // 过滤非字母数字,删除空格
$key = array_search($token, $tokenList);
if ($key) {
if ($key >= 0) {
return $key;
} else {
return ('没有这个用户ID');
}
};
};
// 通过ID查找用户Token
function getIDToken($id)
{
global $tokenList;
$id = preg_replace('/[\W]/', '', $id); // 过滤非字母数字,删除空格
foreach ($tokenList as $key => $value) {
if ($key == $id) {
return $value;
}
}
};

View File

@ -60,7 +60,7 @@ $config = array(
// 登录上传和后台管理密码,管理用户名为admin
'password' => 'admin@123',
// 是否开启API上传 开启:true 关闭:false
'apiStatus' => true,
'apiStatus' => false,
// 是否开启水印:0关闭1文字水印2图片水印 不能使用动态gif添加水印
'watermark' => 0,
// 水印文字内容
@ -81,7 +81,7 @@ $config = array(
// 图片水印路径 支持GIF,JPG,BMP,PNG和PNG alpha
'waterImg' => 'public/images/watermark.png',
// 允许上传的图片扩展名
'extensions' => array('bmp', 'jpg', 'png', 'tif', 'gif', 'pcx', 'tga', 'svg', 'webp', 'jpeg', 'tga', 'svg', 'ico'),
'extensions' => ['bmp', 'jpg', 'png', 'tif', 'gif', 'pcx', 'tga', 'svg', 'webp', 'jpeg', 'tga', 'svg', 'ico'],
// 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:''
'imgConvert' => '',
// 最大上传宽度
@ -92,12 +92,12 @@ $config = array(
'minWidth' => 5,
// 允许上传的最小高度
'minHeight' => 5,
// 等比例缩小图片 宽度和高度请设置 image_x image_y 开启:true 关闭:false 关闭下image_x和image_y设置不生效
// 改变图片宽高 宽度和高度请设置 image_x image_y 开启:true 关闭:false 关闭下image_x和image_y设置不生效
'imgRatio' => false,
// 缩减的最大高度
'image_x' => 10240,
'image_x' => 1000,
// 缩减的最大宽度
'image_y' => 10240,
'image_y' => 800,
// 开启静态文件CDN 开启:true 关闭:false
'static_cdn' => false,
// 开启顶部广告 开启:true 关闭:false 如果想添加或修改广告请到 public/static/ad_top.html
@ -108,7 +108,7 @@ $config = array(
'showSwitch' => true,
// 默认预览数量,可在网址后填写参数实时更改预览数量 如https://img.545141.com/libs/list.php?num=3
'listNumber' => 20,
// 上传框底部自定义信息仅支持html格式
// 上传框底部自定义信息仅支持html格式 下面是举例:
'customize' => '
<!--打赏
<div id="ad" class="col-md-12" align="center" style="padding:5px;">
@ -120,19 +120,17 @@ $config = array(
-->
<!-- QQ邮箱、QQ群
<a target="_blank" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=cR0UHB4fGBwxAABfEh4c">
<span class="label label-primary label-outline">
<i class="icon icon-envelope-alt">联系邮箱</i></span>
</a>
<i class="icon icon-envelope-alt">联系邮箱 </i></span>
</a>
<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f">
<span class="label label-primary label-outline">
<i class="icon icon-qq">加入QQ群</i></span>
</a>
-->
-->
',
// 扩展与基本设置检测 开启:true 关闭:false
'checkEnv' => true,
// 当前版本
'version' => '2.1.0',
'version' => '2.1.1',
);

View File

@ -12,7 +12,7 @@ if ($handle->uploaded) {
// 文件命名
$handle->file_new_name_body = imgName();
// 最大上传限制
$handle->file_max_sizes = $config['maxSize'];
//$handle->file_max_sizes = $config['maxSize'];
// 最大宽度
$handle->image_max_width = $config['maxWidth'];
// 最大高度
@ -23,13 +23,15 @@ if ($handle->uploaded) {
$handle->image_min_height = $config['minHeight'];
// 转换图片为指定格式
$handle->image_convert = $config['imgConvert'];
//等比例缩减图片
/* 等比例缩减图片
if ($config['imgRatio']) {
$handle->image_resize = true;
$handle->image_x = $config['image_x'];
$handle->image_y = $config['image_y'];
}
*/
// 存储图片路径:images/201807/
$handle->process(__DIR__ . config_path());
@ -73,8 +75,6 @@ if ($handle->uploaded) {
// 图片完整相对路径:/i/2021/05/03/k88e7p.jpg
if ($handle->processed) {
header('Content-type:text/json');
// 上传成功后返回json数据
$imageUrl = $config['domain'] . config_path() . $handle->file_dst_name;
$delUrl = $config['domain'] . '/api/del.php?hash=' . urlHash(config_path() . $handle->file_dst_name, 0);

BIN
i/2021/05/06/7301my.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
i/2021/05/07/12bs09o.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

BIN
i/2021/05/07/12c4z5y.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
i/2021/05/07/12ccq85.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

BIN
i/2021/05/07/12cpw4v.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
i/2021/05/07/12crvx0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
i/2021/05/07/12ctbu2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/12czela.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

BIN
i/2021/05/07/12dix6i.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 KiB

BIN
i/2021/05/07/12dwqch.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

BIN
i/2021/05/07/12epfwj.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

BIN
i/2021/05/07/12f2rc4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

BIN
i/2021/05/07/12gd0jw.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/12is9qy.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

BIN
i/2021/05/07/12k2dve.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
i/2021/05/07/12kokyn.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
i/2021/05/07/12lpwkl.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

BIN
i/2021/05/07/12owu9j.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
i/2021/05/07/12p70y1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/12r0h6m.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/12r2lno.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
i/2021/05/07/12r4hrn.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

BIN
i/2021/05/07/12r4k40.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
i/2021/05/07/12rlyrp.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/12rnc1q.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
i/2021/05/07/12rrz19.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

BIN
i/2021/05/07/12rvtoz.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

BIN
i/2021/05/07/12tgosw.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
i/2021/05/07/12ti61v.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
i/2021/05/07/12unogl.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
i/2021/05/07/12uuhgr.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
i/2021/05/07/12v8mmo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

BIN
i/2021/05/07/12vcb0n.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
i/2021/05/07/12veu16.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
i/2021/05/07/12vwfpk.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

BIN
i/2021/05/07/12wx2ak.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
i/2021/05/07/12x0so0.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/12y40us.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/12zhb6t.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/12zj486.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

BIN
i/2021/05/07/1301eeo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/1303e94.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

BIN
i/2021/05/07/1304sb4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
i/2021/05/07/1306r5c.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
i/2021/05/07/1307uyw.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
i/2021/05/07/130kono.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

BIN
i/2021/05/08/4x6k4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

BIN
i/2021/05/08/heo6s.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
i/2021/05/08/jz37e.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
i/2021/05/08/kbosa.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
i/2021/05/08/ll31ms.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 KiB

BIN
i/2021/05/08/ll33ky.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 KiB

BIN
i/2021/05/08/lluiqx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
i/2021/05/08/lm6kpq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 KiB

BIN
i/2021/05/08/lx1t2x.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

BIN
i/2021/05/08/lxovmx.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

BIN
i/2021/05/08/lybi9v.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

BIN
i/2021/05/08/lydunt.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

BIN
i/2021/05/08/lyqap5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

BIN
i/2021/05/08/m33acm.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

BIN
i/2021/05/08/m44d6r.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
i/2021/05/08/m47ro4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

BIN
i/2021/05/08/m4vopo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

BIN
i/2021/05/08/m8ceyx.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

BIN
i/2021/05/08/m8fxqe.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

BIN
i/2021/05/08/mawpr3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

BIN
i/2021/05/08/mbsr1a.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
i/2021/05/08/mcdye2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
i/2021/05/08/mckbn9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

BIN
i/2021/05/08/mdnogz.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB

BIN
i/2021/05/08/mdukdv.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

BIN
i/2021/05/08/mfkm4i.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

BIN
i/2021/05/08/mg5cgi.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
i/2021/05/08/mgl2g0.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

BIN
i/2021/05/08/nvbr55.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@ -82,13 +82,13 @@ mustLogin();
<script src="public/static/copy_btn.js"></script>
<script>
$('#upShowID').uploader({
// 当选择文件后立即自动进行上传操作
// 自动上传
autoUpload: false,
// 文件上传提交地址
url: 'file.php',
// 最大支持的上传文件
max_file_size: <?php echo $config['maxSize']; ?>,
// 是否分片上传 0为不分片 经测试分片容易使图片上传失败
// 分片上传 0为不分片 分片容易使图片上传失败
chunk_size: 0,
//点击文件列表上传文件
browseByClickList: true,
@ -96,7 +96,11 @@ mustLogin();
filters: { // 只允许上传图片或图标(.ico
mime_types: [{
title: '图片',
extensions: '<?php echo getExtensions(); ?>'
extensions: <?php echo "'";
foreach ($config['extensions'] as $extensions) {
echo $extensions . ',';
}
echo "'"; ?>,
}, {
title: '图标',
extensions: 'ico'
@ -107,11 +111,12 @@ mustLogin();
limitFilesCount: <?php echo $config['maxUploadFiles']; ?>,
// 自动上传失败的文件
autoResetFails: true,
<?php imgRatio(); ?>
responseHandler: function(responseObject, file) {
// 当服务器返回的文本内容包含 `'success'` 文件上传成功
if (responseObject.response.indexOf('success')) {
var obj = JSON.parse(responseObject.response); //由JSON字符串转换为JSON对象
var obj = JSON.parse(responseObject.response); //由JSON字符串转换为JSON对象
console.log(responseObject.response); // 输出log
if (obj.result === 'success') {
var links = document.getElementById("links");
links.innerHTML += obj.url + "\n";
@ -125,12 +130,11 @@ mustLogin();
html.innerHTML += "&lt;img src=\"" + obj.url + "\" alt=\"简单图床 - EasyImage\" /&#62;\n";
var del = document.getElementById("del");
//del.innerHTML += obj.del + "\n";
del.innerHTML += obj.del + "\n";
} else {
return '上传失败。服务器返回了一个错误:' + responseObject.response;
return '上传失败,服务器返回错误:' + obj.message;
}
console.log(responseObject.response);
}
});
</script>

View File

@ -48,8 +48,8 @@
makeCode();
}
});
</script>
<script>
// NProgress
$("body").show();
$(".version").text(NProgress.version);
NProgress.start();
@ -74,29 +74,23 @@
<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>
<p>
<span class="label label-dot label-outline">Default</span>
<span class="label label-dot label-primary label-outline">Primary</span>
<span class="label label-dot label-success label-outline">Success</span>
<span class="label label-dot label-info label-outline">Info</span>
<span class="label label-dot label-warning label-outline">Warning</span>
<span class="label label-dot label-danger label-outline">Danger</span>
</p>
<!-- 对话框触发按钮 -->
<a href="#" data-position="center" data-moveable="inside" data-moveable="true" data-toggle="modal" data-target="#myModal">
<span class="label"><i class="icon icon-qrcode"></i> 二维码</a></span>
<a href="/tinyfilemanager.php?p=<?php echo date('Y/m/d'); ?>" target="_blank"><span class="label"><i class="icon icon-desktop"></i> 管理</a></span>
<a href="/api/api-web.php" target="_blank"><span class="label"><i class="icon icon-key"></i> API</a></span>
<i class="icon icon-qrcode"></i>二维码 </a>
<a href="/tinyfilemanager.php?p=<?php echo date('Y/m/d'); ?>" target="_blank" ><i class="icon icon-desktop"></i>管理 </a>
<a href="/api/api-web.php" target="_blank"><i class="icon icon-key"></i>API </a>
<?php
if (is_online()) {
echo '<a href="/libs/logout.php" ><span class="label"><i class="icon icon-signout"></i> 退出</a></span>';
echo '<a href="/libs/logout.php" ><i class="icon icon-signout"></i>退出 </a>';
} else {
echo '<a href="/libs/login.php" ><span class="label"><i class="icon icon-user"></i> 登录</a></span>';
echo '<a href="/libs/login.php" ><i class="icon icon-user"></i>登录 </a>';
} ?>
</div>
<hr>
<p>请勿上传违反中国政策的图片<i class="icon icon-smile"></i></p>
<?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" target="_blank"><?php echo $config['version']; ?> <i class="icon icon-github"></i></a>

View File

@ -58,10 +58,11 @@ function mustLogin()
}
// 检查配置文件中目录是否存在是否可写并创建相应目录
function config_path()
function config_path($path = null)
{
global $config;
$img_path = $config['path'] . date('Y/m/d/');
$path = $path ?? date('Y/m/d/');
$img_path = $config['path'] . $path;
if (!is_dir($img_path)) {
@mkdir($img_path, 0755, true);
@ -307,10 +308,10 @@ function urlHash($data, $mode)
$key = $config['password'];
$iv = 'sciCuBC7orQtDhTO';
if ($mode) {
$decode = openssl_decrypt(base64_decode($data), "AES-128-CBC", $key, 0,$iv);
$decode = openssl_decrypt(base64_decode($data), "AES-128-CBC", $key, 0, $iv);
return $decode;
} else {
$encode = base64_encode(openssl_encrypt($data, "AES-128-CBC", $key, 0,$iv));
$encode = base64_encode(openssl_encrypt($data, "AES-128-CBC", $key, 0, $iv));
return $encode;
}
}
@ -413,4 +414,23 @@ function checkEnv($mode)
';
}
}
}
}
// 前端改变图片长宽
function imgRatio()
{
global $config;
if ($config['imgRatio']) {
$image_x = $config['image_x'];
$image_y = $config['image_y'];
echo '
resize:{
width: ' . $image_x . ',
height: ' . $image_y . ',
preserve_headers: false, // 是否保留图片的元数据
},
';
} else {
return null;
}
}

View File

@ -34,15 +34,8 @@ echo '<!DOCTYPE html>
<i class="icon icon-home"> 首页</i>
</a>
</li>
<!-- 管理
<li>
<a href="//' . $_SERVER['HTTP_HOST'] . '/tinyfilemanager.php?p=' . date('Y/m/d') . '" target="_blank">
管理
</a>
</li>
-->
<li class="' . getActive('list') . '">
<a href="//' . $_SERVER['HTTP_HOST'] . '/libs/list.php">
<a href="//' . $_SERVER['HTTP_HOST'] . '/libs/list.php?date='. date('Y/m/d/').'&num='.$config['listNumber'].'">
<i class="icon icon-list"> 广场</i>
<span class="label label-badge label-success">
' . getFileNumber(__DIR__ . '/../' . config_path()) . '</span>
@ -53,25 +46,6 @@ echo '<!DOCTYPE html>
<i class="icon icon-github "> 源码下载</i>
</a>
</li>
<!-- 弹窗
<li>
<a class="dropdown-toggle" data-toggle="dropdown" href="###">更多 <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="">任务</a>
</li>
<li>
<a href="">Bug</a>
</li>
<li>
<a href="">需求</a>
</li>
<li>
<a href="">用例</a>
</li>
</ul>
</li>
-->
</ul>
</div>
<!-- 顶部导航栏END -->

View File

@ -2,22 +2,16 @@
require_once __DIR__ . '/header.php';
if ($config['showSwitch']) {
$path = $_GET['date'] ?? date('Y/m/d/');
$keyNum = $_GET['num'] ?? $config['listNumber'];
$fileArr = getFile('..' . config_path());
$fileArr = getFile('..' . config_path($path));
if (isset($_GET['num'])) {
$keyNum = $_GET['num'];
} else {
$keyNum = $config['listNumber'];
}
if ($fileArr[0] == null) {
echo '<p class="text-danger" style="center">今天还没有上传的图片哟~~ <br />快来上传第一张吧~</p>';
} else {
foreach ($fileArr as $key => $value) {
if ($key < $keyNum) {
$boxImg = $config['domain'] . config_path() . $value;
echo '<div class="col-md-4 col-sm-6 col-lg-3"><div class="card listNum"><img data-toggle="lightbox" data-image="' . $boxImg . '" src="' . $boxImg . '"
if ($fileArr[0]) {
foreach ($fileArr as $key => $value) {
if ($key < $keyNum) {
$boxImg = $config['domain'] . config_path($path) . $value;
echo '<div class="col-md-4 col-sm-6 col-lg-3"><div class="card listNum"><img data-toggle="lightbox" data-image="' . $boxImg . '" src="' . $boxImg . '"
class="img-thumbnail" alt="简单图床-EasyImage" >
<a href="' . $boxImg . '" target="_blank">
<div class="pull-left" style="margin-top:5px;">
@ -31,19 +25,32 @@ if ($config['showSwitch']) {
</a>
</div>
</div>';
}
}
}
}
}
} else {
echo '<p class="text-danger" style="center">今天还没有上传的图片哟~~ <br />快来上传第一张吧~</p>';
}
} else {
echo '<p class="text-danger" style="center">管理员关闭了预览哦~~</p>';
echo '<p class="text-danger" style="center">管理员关闭了预览哦~~</p>';
}
$todayUpload = getFileNumber('../' . config_path()); // 今日上传数量
$yesterday = date("Y/m/d/", strtotime("-1 day")); // 昨日日期
$yesterdayUpload = getFileNumber('../' . $config['path'] . $yesterday); // 昨日上传数量
$spaceUsed = getDistUsed(disk_total_space(__DIR__) - disk_free_space(__DIR__)); // 占用空间
$httpUrl = array(
'date' => $path,
'num' => getFileNumber('..' . config_path($path)),
);
echo '
<div class="col-md-12">
<span class="label label-success label-outline"> 今日上传:' . getFileNumber(__DIR__ . '/../' . config_path()) . ' </span>
<span class="label label-warning label-outline"> 昨日上传:' . getFileNumber(__DIR__ . '/../' . $config['path'] . date("Y/m/d/", strtotime("-1 day"))) . ' </span>
<a href="?num=' . getFileNumber(__DIR__ . '/../' . config_path()) . '" ><span class="label label-info label-outline"> 今日全部上传</span></a>
<span class="label label-danger label-outline"> 存储占用:' . getDistUsed(disk_total_space(__DIR__) - disk_free_space(__DIR__)) . '</span>
<a href="list.php" ><span class="label label-success label-outline"> 今日上传:' . $todayUpload . ' </span></a>
<a href="list.php?date=' . $yesterday . '" ><span class="label label-warning label-outline"> 昨日上传:' . $yesterdayUpload . ' </span></a>
<a href="list.php?' . http_build_query($httpUrl) . '" ><span class="label label-info label-outline"> 全部上传</span></a>
<span class="label label-danger label-outline"> 存储占用:' . $spaceUsed . '</span>
</div>
';
require_once './footer.php';