update chart

pull/18/head
icret 2021-11-13 22:09:30 +08:00
parent 321c5dd25e
commit fd0606f1ec
11 changed files with 492 additions and 683 deletions

247
README.md
View File

@ -1,247 +0,0 @@
![简单图床示例](https://i1.100024.xyz/i/2020/12/31/ulmtho.png
"简单图床示例")
![简单图床示例](https://i1.100024.xyz/i/2020/12/31/ulmjmn.png
"简单图床示例")
## EasyImage 简单图床 2.0
> 支持多文件上传,简单无数据库,返回图片url,markdown,bbscode,html的一款图床程序
演示地址: [https://img.545141.com](https://img.545141.com"https://img.545141.com")
之前一直用的图床程序是:[PHP多图长传程序2.4.3](http://www.mycodes.net/48/4925.htm "PHP多图长传程序2.4.3")
由于版本过老并且使用falsh上传在当前html5流行大势所趋下遂利用基础知识新写了一个以html5为默认上传并且支持flash,向下兼容至IE9。
<hr />
#### 功能支持:
- [x] 支持仅登录后上传
- [x] 支持设置图片质量
- [x] 支持上传图片转换为指定格式
- [x] 支持文字/图片水印
- [x] 支持设置图片指定宽/高
- [x] 支持限制最低宽度/高度上传
- [x] 支持设置广告
- [x] 图片监黄
- [x] 支持开启/关闭api上传
- [x] 在线管理图片(增、删、改、查)
- [x] 支持网站统计 请将统计代码放入:public/static/hm.js
- [x] 更多·····
#### 安装文档
[https://www.kancloud.cn/easyimage/easyimage](https://www.kancloud.cn/easyimage/easyimage)
#### 注意:
1. 第一次访问会检查环境并在config目录下生成EasyImage.lock
2. 请将所有文件赋予0755权限或www权限
3. 上传后必须修改config.php的位置
- domain 当前网站域名
- imgurl 当前图片域名
- password 登录管理密码!
4. 如果无法登陆管理界面或上传图片请检查扩展或者使用phpinfo检查。
5. 可以使用浏览器的 F12调试模式->console查看错误
6. 如果对php不太熟悉的话不要将图床程序放置于二级目录
7. 下载源码后可以删除一些文件README.md,LICENSE
8. 欢迎加群:[623688684](https://shang.qq.com/wpa/qunwpa?idkey=3feb4e8be8f1839f71e53bf2e876de36afc6889b2630c33c877d8df5a5583a6f)
#### 安全配置
- Apache配置文件默认设置上传目录不可运行
```Apache
RewriteEngine on RewriteCond % !^$
RewriteRule i/(.*).(php)$ [F]
RewriteRule public/(.*).(php)$ [F]
RewriteRule config/(.*).(php)$ [F]
```
- Nginx请在Nginx配置
```Nginx
# 禁止运行php的目录
location ~* ^/(i|public|config)/.*\.(php|php5)$
{
deny all;
}
```
- 或者参考:[https://www.545141.com/981.html](https://www.545141.com/981.html)
<details><summary><mark><font color=darkred>点击查看2.0版更新日志</font></mark></summary>
* 2021-11-12 v2.4.1
- 增加缓存周期配置
- 增加上传统计
- 增加viewjs
- 更新依赖件
- 修复统计错误
* 2021-11-9 v2.4.0
- 增加统计缓存
- 增加最近30天上传统计与占用空间图表
- 增加初始化安装可能会不支持二级目录安装可删除install文件夹初始化)
- 增加在线编辑配置(之前是需要修改config.php文件现在可以直接网站端修改了)
- 删除广场会导致浏览速度变慢的代码
- 删除快捷配置会导致浏览速度变慢的代码
* 2021-11-3 v2.3.2
- 增加广场图片缓存
- 重构广场样式
* 2021-11-3 v2.3.1
- 增加监黄接口
- 增加审核违规图片
- 修复对php5.6的支持
- 修复二级目录的安装
* 2021-10-24 v2.3.0
- 将服务器环境监测改为第一次打开时自动检测如需再次展示需删除config目录下的EasyImage.lock
- 增加快捷操作中心显示服务信息
- 增加对上传文件的命名方式详见config.php文件里的注释
- 增加隐私政策、服务条款、DMCA
- 增加自定义静态文件CDN源
- 增加dns-prefetch
- 删除了tinyfilemanager文件管理感觉没什么用
- 一些bug得以修复
* 2021-5-22 v2.2.0
- 增加根目录静态属性
- 增加浏览页面懒加载
- 增加浏览页面启用选定日期查看图片
- 增加版本检测 ***每月10日06点和25日01点检测Github是否更新***
- 增加上传压缩 ***此压缩有可能使图片变大!特别是小图片 也有一定概率改变图片方向***
- 增加批量压缩目录 ***TinyImag或本机压缩本机压缩出现的问题***
- 修复title
- 修复二级目录安装
- 修复对PHP5.6的兼容 ***建议使用php7.0及以上!***
* 2021-5-8 v2.1.1
- 修复上传界面上传失败提示信息bug
- 浏览页面重构
- 删除页面添加登录删除
- 调整首页显示
- 将调整图片长宽放置前端,减小资源开销
- 其他小调整
* 2021-5-2 v2.1
- 将tinyfilemanager配置文件简单翻译并集成到config.php
- 增加底部自定义信息
- 增加检测PHP环境给与提示
- 增加删除图片url服务器不会保存删除链接
- 恢复随机浏览20张上传图片 可以设定浏览数量和关闭浏览
- - 随机浏览图片可以在线删除
- 可以使用 https://img.545141.com/libs/list.php?num=100 定义浏览数量
- 修复一些调用
- 更改二维码显示方式
- 开启api 需要token验证上传
- 重构并修复check.php相关文件
- 重构部分代码
- 更改目录结构
- 增加安全性配置
- * Apache配置文件默认设置上传目录不可运行
```Apache
RewriteEngine on RewriteCond % !^$
RewriteRule i/(.*).(php)$ [F]
RewriteRule public/(.*).(php)$ [F]
RewriteRule config/(.*).(php)$ [F]
```
- * Nginx请在Nginx配置
```Nginx
# 禁止运行php的目录
location ~* ^/(i|public|config)/.*\.(php|php5)$
{
deny all;
}
```
- - 或者参考https://www.545141.com/992.html https://www.545141.com/939.html
- 一些精简
* 2021-4-14 v2.0.2.1 Dev1
- 更新静态文件版本
- 请所有更新过2.0.2.1版本升级到此版本
- 更改一些描述
- md5提交登录验证
- 登录上传也显示公告
* 2021-03-28 v2.0.2.1
- 更新管理程序,修复部分漏洞
- 修复不能等比例缩小图片
- 支持php8
* 2019-6-26 v2.0.2.0
- 精简压缩代码,使得不再压缩后反而变大
- 删除异域上传功能,不再支持异域上传
- 修复开启登录后无法粘贴密码
- 后台控制上传数量,上传格式
- 其他一些优化
* 2019-6-14 v2.0.1.9
- 增加复制链接按钮
- 增加暂停上传按钮
- 增加QQ截图剪切板上传
- 增加文字/图片水印透明度
- 恢复开启/关闭api上传
- 恢复支持水印文字颜色
- 恢复支持远程上传图片
- 修复安装时候的权限
- 修复管理无法多选的问题
- 修复上传透明png背景变为纯黑的问题
- 修复成功上传图片但前端无法获取链接
- 修复在centos64 lnmp1.6 php7.1环境下的图片信息读取问题
- 修改图片压缩方式速度更快相比之前提高5倍以上
- 更改管理路径
- 更改上传路径,文件名更短
- 更改上传显示方式为缩略图
- 关闭添加图片后自动上传
- 纪念一下2019年将版本号改为2.0.1.9
* 2019-5-23 v2.0
- 在继承上个版本1.6.4)的基础上进行了全新优化
- 修复上传经常失败的问题
- 删除一些不常用但会增加功耗的过程
- 全新的压缩 将文件继续缩小
- 全新的目录系统,精简代码
- 设置仅允许在config.php修改注释更加明了即使没有代码基础也可以操作
- 增加新的文件管理系统,感谢 tinyfilemanager
- ~~支持文字/图片水印 可自定义文字颜色~~
- ~~支持文字水印背景颜色~~
- ~~支持文字水印透明度~~
- ~~支持删除远程上传文件~~ -> 不再支持删除远程文件
- ~~(支持开启/关闭api自定义文字水印)~~
- ~~支持删除自定义删除图片(仅管理员)~~
</details>
<details><summary><mark><font color=darkred>与1.6.4版本差别</font></mark></summary>
- 在继承上个版本([1.6.4](https://github.com/icret/easyImages "1.6.4"))的基础上进行了全新优化
- 修复上传经常失败的问题
- 删除一些不常用但会增加功耗的过程 (删除的在下边会有标记)
- 全新的压缩 将文件继续缩小
- 全新的目录系统,精简代码
- 设置仅允许在config.php修改注释更加明了即使没有代码基础也可以操作
- 增加新的文件管理系统,感谢 tinyfilemanager
- ~~支持文字/图片水印 可自定义文字颜色~~
- ~~支持文字水印背景颜色~~
- ~~支持文字水印透明度~~
- ~~支持删除远程上传文件~~ -> 不再支持删除远程文件
- ~~(支持开启/关闭api自定义文字水印)~~
- ~~支持删除自定义删除图片(仅管理员)~~
</details>
<br />
不建议再使用 [EasyImage 1.6.4版本](https://github.com/icret/easyImages)
<hr />
#### 兼容性
PHP推荐使用PHP7.0及以上版本,需要PHP支持Fileinfo、iconv、zip、mbstring、openssl 扩展,如果缺失会导致无法访问管理面板以及上传/删除图片。
文件上传视图提供文件列表管理和文件批量上传功能,允许拖拽(需要 HTML5 支持)来添加上传文件,支持上传大图片,优先使用 HTML5旧的浏览器自动使用Flash和Silverlight的方式兼容。
<hr />
- 感谢: [verot](https://github.com/verot/class.upload.php "verot" )提供非常好用的class.upload.php上传类
- 感谢: [ZUI](https://github.com/easysoft/zui "ZUI" ) 提供css框架
- 本源码遵循 GNU Public License

View File

@ -1,249 +0,0 @@
<?php
/*
* 统计中心
*/
require_once '../application/header.php';
require_once APP_ROOT . '/config/api_key.php';
require_once APP_ROOT . '/api/application/apiFunction.php';
require_once APP_ROOT . '/application/chart.php';
// 检测登录
if (!is_online()) {
checkLogin();
}
// 统计图表
// array_reverse($arr,true) 倒叙数组并保持键值关系
$char_data = read_chart_total();
if (is_array($char_data)) {
$chart_date = '';
foreach (array_reverse($char_data['date'], true) as $value) {
$chart_date .= $value;
}
$chart_date = str_replace(date('Y/'), '', $chart_date); // 删除年份
$chart_number = '';
foreach (array_reverse($char_data['number'], true) as $value) {
$chart_number .= $value;
}
$chart_disk = '';
foreach (array_reverse($char_data['disk'], true) as $value) {
$chart_disk .= $value;
}
}
?>
<style>
.autoshadow {
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1);
border: 1px;
margin: 0px 0px 10px 10px;
width: 101px;
height: 80px;
text-align: center;
}
.autoshadow:hover {
width: 105px;
height: 80px;
border: 2px;
box-shadow: 3px 2px 3px 2px rgba(19, 17, 36, 0.5);
}
</style>
<div class="row">
<div class="clo-md-12">
<div class="alert alert-warning">统计时间:<?php echo $char_data['total_time']; ?></div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="col-md-2 alert alert-success autoshadow">今日上传
<hr />
<?php printf("%u 张", preg_replace('/\D/s', '', $char_data['number'][0])); ?>
</div>
<div class="col-md-2 alert alert-success autoshadow">昨日上传
<hr />
<?php printf("%u 张", preg_replace('/\D/s', '', $char_data['number'][1])); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
累计上传
<hr />
<?php printf("%u 张", read_total_json('filenum')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
缓存文件
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'cache/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
可疑图片
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'suspic/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
文件夹
<hr />
<?php printf("%d 个", read_total_json('dirnum')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
占用存储
<hr />
<?php echo getDistUsed(disk_total_space('.') - disk_free_space('.')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
剩余空间
<hr />
<?php echo getDistUsed(disk_free_space('.')); ?>
</div>
</div>
<div class="col-md-6">
<div id="myPieChart" style="width:300px;height: 300px;"></div>
</div>
</div>
<div class="col-md-12">
<hr />
<div id="myLineChart" style="width: 100%;height: 300px;"></div>
<h4 style="text-align: center;">最近30日上传趋势与空间占用</h4>
</div>
</div>
<script src="<?php static_cdn(); ?>/public/static/echarts/echarts.simple.min.js"></script>
<script>
// 文件统计-折线图
var myChart = echarts.init(document.getElementById('myLineChart'));
window.onresize = function() {
myChart.resize();
};
var LineChart = {
color: ['#EA644A', '#38B03F'],
title: {
// text: '最近30日上传趋势与空间占用'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: ['上传', '占用']
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [<?php echo rtrim($chart_date, ','); ?>],
},
yAxis: {},
series: [{
name: '占用',
type: 'line',
stack: 'x',
smooth: true,
areaStyle: {},
emphasis: {
focus: 'series'
},
data: [<?php echo rtrim($chart_disk, ','); ?>],
}, {
name: '上传',
type: 'line',
stack: 'x',
smooth: true,
areaStyle: {},
emphasis: {
focus: 'series'
},
data: [<?php echo rtrim($chart_number, ','); ?>],
},
]
};
myChart.setOption(LineChart);
// 硬盘统计-饼状图
var myChart = echarts.init(document.getElementById('myPieChart'));
myPieChart = {
color: ['#38B03F', '#353535'],
title: {
// text: '硬盘使用统计GB',
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} GB ({d}%)'
},
legend: {
orient: 'vertical',
left: 'left',
data: ['剩余空间', '已用空间']
},
series: [{
name: '硬盘使用:',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: [{
value: <?php echo round(disk_free_space('.') / 1024 / 1024 / 1024, 2); ?>,
name: '剩余空间',
},
{
value: <?php echo round((disk_total_space('.') - disk_free_space('.')) / 1024 / 1024 / 1024, 2); ?>,
name: '已用空间'
},
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(myPieChart);
let currentIndex = -1;
setInterval(function() {
var dataLen = myPieChart.series[0].data.length;
// 取消之前高亮的图形
myChart.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: currentIndex
});
currentIndex = (currentIndex + 1) % dataLen;
// 高亮当前图形
myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: currentIndex
});
// 显示 tooltip
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: currentIndex
});
}, 1000);
</script>
<?php require_once APP_ROOT . '/application/footer.php';

View File

@ -31,182 +31,232 @@ if (is_array($char_data)) {
$chart_disk .= $value;
}
}
?>
<style>
.autoshadow {
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1);
border: 1px;
margin: 0px 0px 10px 10px;
width: 130px;
width: 101px;
height: 80px;
text-align: center;
}
.autoshadow:hover {
width: 105px;
height: 80px;
border: 2px;
box-shadow: 3px 2px 3px 2px rgba(19, 17, 36, 0.5);
}
</style>
<div class="row">
<div class="clo-md-12">
<div class="alert alert-warning">统计时间:<?php echo $char_data['total_time']; ?></div>
</div>
<div class="col-md-12">
<div class="col-md-2 alert alert-success autoshadow">今日上传
<hr />
<?php printf("%u 张", preg_replace('/\D/s', '', $char_data['number'][0])); ?>
</div>
<div class="col-md-2 alert alert-success autoshadow">昨日上传
<hr />
<?php printf("%u 张", preg_replace('/\D/s', '', $char_data['number'][1])); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
累计上传
<hr />
<?php printf("%u 张", read_total_json('filenum')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
缓存文件
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'cache/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
可疑图片
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'suspic/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
文件夹
<hr />
<?php printf("%d 个", read_total_json('dirnum')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
占用存储
<hr />
<?php echo getDistUsed(disk_total_space('.') - disk_free_space('.')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
剩余空间
<hr />
<?php echo getDistUsed(disk_free_space('.')); ?>
</div>
</div>
<div class="col-md-22">
<div class="col-md-6">
<h4>文件统计(张)</h4>
<canvas id="myBarChart" width="960" height="400"></canvas>
<div class="col-md-2 alert alert-success autoshadow">今日上传
<hr />
<?php printf("%u 张", preg_replace('/\D/s', '', $char_data['number'][0])); ?>
</div>
<div class="col-md-2 alert alert-success autoshadow">昨日上传
<hr />
<?php printf("%u 张", preg_replace('/\D/s', '', $char_data['number'][1])); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
累计上传
<hr />
<?php printf("%u 张", read_total_json('filenum')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
缓存文件
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'cache/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
可疑图片
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'suspic/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
文件夹
<hr />
<?php printf("%d 个", read_total_json('dirnum')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
占用存储
<hr />
<?php echo getDistUsed(disk_total_space('.') - disk_free_space('.')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
剩余空间
<hr />
<?php echo getDistUsed(disk_free_space('.')); ?>
</div>
</div>
<div class="col-md-6">
<h4 class=" col-md-offset-2">硬盘统计GB</h4>
<canvas id="diskPieChart" width="960" height="400"></canvas>
<div id="myPieChart" style="width:300px;height: 300px;"></div>
</div>
</div>
<div class="col-sm-12" style="text-align: center;">
<div class="col-md-12">
<hr />
<h4>最近30上传趋势与空间占用上传/ 占用/MB</h4>
<h4 class="text-danger hidden-lg">手机请启用横屏浏览</h4>
<canvas id="myChart" width="1080" height="200"></canvas>
<div id="myLineChart" style="width: 100%;height: 300px;"></div>
<h4 style="text-align: center;">最近30日上传趋势与空间占用</h4>
</div>
</div>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/chart/zui.chart.min.js"></script>
<!--[if lt IE 9]>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/chart/excanvas.js"></script>
<![endif]-->
<script src="<?php static_cdn(); ?>/public/static/echarts/echarts.common.min.js"></script>
<script>
// 文件统计-柱状图
var data = {
labels: ["今日上传", "昨日上传", "累计上传", "缓存文件", "可疑图片", "已创建文件夹"],
datasets: [{
label: "文件统计",
color: 'green',
data: [<?php echo str_replace('"', '', $char_data['number'][0] . $char_data['number'][1] . read_total_json('filenum') . ',' . getFileNumber(APP_ROOT . $config['path'] . 'cache/') . ',' . getFileNumber(APP_ROOT . $config['path'] . 'suspic/') . ',' . read_total_json('dirnum')); ?>]
}]
// 文件统计-折线图
var myChart = echarts.init(document.getElementById('myLineChart'));
window.onresize = function() {
myChart.resize();
};
var options = {
responsive: true,
var LineChart = {
color: ['#EA644A', '#38B03F'],
title: {
// text: '最近30日上传趋势与空间占用'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: ['上传', '占用']
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [<?php echo rtrim($chart_date, ','); ?>],
},
yAxis: {
type: 'value',
boundaryGap: [0, '100%']
},
dataZoom: [{ // 放大镜
type: 'inside',
start: 50,
end: 100
},
{
start: 0,
end: 10
}
],
series: [{
name: '占用',
type: 'line',
stack: 'x',
smooth: true,
areaStyle: {},
emphasis: {
focus: 'series'
},
data: [<?php echo rtrim($chart_disk, ','); ?>],
}, {
name: '上传',
type: 'line',
stack: 'x',
smooth: true,
areaStyle: {},
emphasis: {
focus: 'series'
},
data: [<?php echo rtrim($chart_number, ','); ?>],
},
scaleShowLabels: true, // 展示标签
scaleLabelPlacement: "outside",
// Interpolated JS string - 坐标刻度格式化文本
scaleLabel: "<%=value%>",
scaleShowLabels: true,
//Boolean - 是否启用缩放动画
animateScale: true,
// Number - 自定义坐标网格时起始刻度值
scaleStartValue: 0,
// Boolean - 是否启用响应式设计,在窗口尺寸变化时进行重绘
responsive: true,
]
};
var myBarChart = $('#myBarChart').barChart(data, options);
// 最近30上传趋势与空间占用-折线图
var ctx = $("#myChart").get(0).getContext("2d");
// 使用$.zui.Chart构造Chart实例
var myNewChart = new $.zui.Chart(ctx);
var data = {
// labels 数据包含依次在X轴上显示的文本标签
labels: [<?php echo rtrim($chart_date, ','); ?>],
datasets: [{
// 数据集名称,会在图例中显示
label: "上传",
color: "green",
// 数据集
data: [<?php echo rtrim($chart_number, ','); ?>]
}, {
label: "占用",
color: "red",
data: [<?php echo rtrim($chart_disk, ','); ?>]
}]
};
var options = {
//Boolean - 是否启用缩放动画
animateScale: true,
// Number - 自定义坐标网格时起始刻度值
scaleStartValue: 0,
// Boolean - 是否启用响应式设计,在窗口尺寸变化时进行重绘
responsive: true,
};
var myLineChart = $("#myChart").lineChart(data, options);
myChart.setOption(LineChart);
// 硬盘统计-饼状图
var data = [{
value: <?php echo round(disk_free_space('.') / 1024 / 1024 / 1024, 2); ?>,
color: "green", // 使用颜色名称
label: "剩余空间"
}, {
value: <?php echo round((disk_total_space('.') - disk_free_space('.')) / 1024 / 1024 / 1024, 2); ?>,
var myChart = echarts.init(document.getElementById('myPieChart'));
color: "red", // 自定义颜色
// highlight: "#FF5A5E", // 自定义高亮颜色
label: "已用空间"
}];
var options = {
scaleShowLabels: true, // 展示标签
scaleLabelPlacement: "outside",
// Interpolated JS string - 坐标刻度格式化文本
scaleLabel: "<%=value%>GB",
scaleShowLabels: true,
//Boolean - 是否启用缩放动画
animateScale: true,
// Number - 自定义坐标网格时起始刻度值
scaleStartValue: 0,
// Boolean - 是否启用响应式设计,在窗口尺寸变化时进行重绘
responsive: true,
myPieChart = {
color: ['#38B03F', '#353535'],
title: {
// text: '硬盘使用统计GB',
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} GB ({d}%)'
},
legend: {
orient: 'vertical',
left: 'left',
data: ['剩余空间', '已用空间']
},
series: [{
name: '硬盘使用:',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: [{
value: <?php echo round(disk_free_space('.') / 1024 / 1024 / 1024, 2); ?>,
name: '剩余空间',
},
{
value: <?php echo round((disk_total_space('.') - disk_free_space('.')) / 1024 / 1024 / 1024, 2); ?>,
name: '已用空间'
},
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(myPieChart);
// 创建饼图
var myPieChart = $("#diskPieChart").pieChart(data, options);
let currentIndex = -1;
// Title
document.title = "图床统计信息 - <?php echo $config['title']; ?>";
setInterval(function() {
var dataLen = myPieChart.series[0].data.length;
// 取消之前高亮的图形
myChart.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: currentIndex
});
currentIndex = (currentIndex + 1) % dataLen;
// 高亮当前图形
myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: currentIndex
});
// 显示 tooltip
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: currentIndex
});
}, 1000);
</script>
<?php require_once APP_ROOT . '/application/footer.php';

212
admin/zui.chart.php Executable file
View File

@ -0,0 +1,212 @@
<?php
/*
* 统计中心
*/
require_once '../application/header.php';
require_once APP_ROOT . '/config/api_key.php';
require_once APP_ROOT . '/api/application/apiFunction.php';
require_once APP_ROOT . '/application/chart.php';
// 检测登录
if (!is_online()) {
checkLogin();
}
// 统计图表
// array_reverse($arr,true) 倒叙数组并保持键值关系
$char_data = read_chart_total();
if (is_array($char_data)) {
$chart_date = '';
foreach (array_reverse($char_data['date'], true) as $value) {
$chart_date .= $value;
}
$chart_date = str_replace(date('Y/'), '', $chart_date); // 删除年份
$chart_number = '';
foreach (array_reverse($char_data['number'], true) as $value) {
$chart_number .= $value;
}
$chart_disk = '';
foreach (array_reverse($char_data['disk'], true) as $value) {
$chart_disk .= $value;
}
}
?>
<style>
.autoshadow {
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1);
margin: 0px 0px 10px 10px;
width: 130px;
height: 80px;
text-align: center;
}
</style>
<div class="row">
<div class="clo-md-12">
<div class="alert alert-warning">统计时间:<?php echo $char_data['total_time']; ?></div>
</div>
<div class="col-md-12">
<div class="col-md-2 alert alert-success autoshadow">今日上传
<hr />
<?php printf("%u 张", preg_replace('/\D/s', '', $char_data['number'][0])); ?>
</div>
<div class="col-md-2 alert alert-success autoshadow">昨日上传
<hr />
<?php printf("%u 张", preg_replace('/\D/s', '', $char_data['number'][1])); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
累计上传
<hr />
<?php printf("%u 张", read_total_json('filenum')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
缓存文件
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'cache/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
可疑图片
<hr />
<?php printf("%u 张", getFileNumber(APP_ROOT . $config['path'] . 'suspic/')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
文件夹
<hr />
<?php printf("%d 个", read_total_json('dirnum')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
占用存储
<hr />
<?php echo getDistUsed(disk_total_space('.') - disk_free_space('.')); ?>
</div>
<div class="col-md-2 alert alert-primary autoshadow">
剩余空间
<hr />
<?php echo getDistUsed(disk_free_space('.')); ?>
</div>
</div>
<div class="col-md-22">
<div class="col-md-6">
<h4>文件统计(张)</h4>
<canvas id="myBarChart" width="960" height="400"></canvas>
</div>
<div class="col-md-6">
<h4 class=" col-md-offset-2">硬盘统计GB</h4>
<canvas id="diskPieChart" width="960" height="400"></canvas>
</div>
</div>
<div class="col-sm-12" style="text-align: center;">
<hr />
<h4>最近30上传趋势与空间占用上传/ 占用/MB</h4>
<h4 class="text-danger hidden-lg">手机请启用横屏浏览</h4>
<canvas id="myChart" width="1080" height="200"></canvas>
</div>
</div>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/chart/zui.chart.min.js"></script>
<!--[if lt IE 9]>
<script src="<?php static_cdn(); ?>/public/static/zui/lib/chart/excanvas.js"></script>
<![endif]-->
<script>
// 文件统计-柱状图
var data = {
labels: ["今日上传", "昨日上传", "累计上传", "缓存文件", "可疑图片", "已创建文件夹"],
datasets: [{
label: "文件统计",
color: 'green',
data: [<?php echo str_replace('"', '', $char_data['number'][0] . $char_data['number'][1] . read_total_json('filenum') . ',' . getFileNumber(APP_ROOT . $config['path'] . 'cache/') . ',' . getFileNumber(APP_ROOT . $config['path'] . 'suspic/') . ',' . read_total_json('dirnum')); ?>]
}]
};
var options = {
responsive: true,
scaleShowLabels: true, // 展示标签
scaleLabelPlacement: "outside",
// Interpolated JS string - 坐标刻度格式化文本
scaleLabel: "<%=value%>",
scaleShowLabels: true,
//Boolean - 是否启用缩放动画
animateScale: true,
// Number - 自定义坐标网格时起始刻度值
scaleStartValue: 0,
// Boolean - 是否启用响应式设计,在窗口尺寸变化时进行重绘
responsive: true,
};
var myBarChart = $('#myBarChart').barChart(data, options);
// 最近30上传趋势与空间占用-折线图
var ctx = $("#myChart").get(0).getContext("2d");
// 使用$.zui.Chart构造Chart实例
var myNewChart = new $.zui.Chart(ctx);
var data = {
// labels 数据包含依次在X轴上显示的文本标签
labels: [<?php echo rtrim($chart_date, ','); ?>],
datasets: [{
// 数据集名称,会在图例中显示
label: "上传",
color: "green",
// 数据集
data: [<?php echo rtrim($chart_number, ','); ?>]
}, {
label: "占用",
color: "red",
data: [<?php echo rtrim($chart_disk, ','); ?>]
}]
};
var options = {
//Boolean - 是否启用缩放动画
animateScale: true,
// Number - 自定义坐标网格时起始刻度值
scaleStartValue: 0,
// Boolean - 是否启用响应式设计,在窗口尺寸变化时进行重绘
responsive: true,
};
var myLineChart = $("#myChart").lineChart(data, options);
// 硬盘统计-饼状图
var data = [{
value: <?php echo round(disk_free_space('.') / 1024 / 1024 / 1024, 2); ?>,
color: "green", // 使用颜色名称
label: "剩余空间"
}, {
value: <?php echo round((disk_total_space('.') - disk_free_space('.')) / 1024 / 1024 / 1024, 2); ?>,
color: "red", // 自定义颜色
// highlight: "#FF5A5E", // 自定义高亮颜色
label: "已用空间"
}];
var options = {
scaleShowLabels: true, // 展示标签
scaleLabelPlacement: "outside",
// Interpolated JS string - 坐标刻度格式化文本
scaleLabel: "<%=value%>GB",
scaleShowLabels: true,
//Boolean - 是否启用缩放动画
animateScale: true,
// Number - 自定义坐标网格时起始刻度值
scaleStartValue: 0,
// Boolean - 是否启用响应式设计,在窗口尺寸变化时进行重绘
responsive: true,
};
// 创建饼图
var myPieChart = $("#diskPieChart").pieChart(data, options);
// Title
document.title = "图床统计信息 - <?php echo $config['title']; ?>";
</script>
<?php require_once APP_ROOT . '/application/footer.php';

BIN
i/2021/11/13/vfcdex.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

BIN
i/cache/2021_11_13_vfcdex.jpg vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1 @@
{"filename":"00cb28edee3be144f49dc7d643ee7153","total_time":"2021-11-13 22:00:30","date":"2021111322","chart_data":[{"2021\/11\/13\/":1},{"2021\/11\/12\/":0},{"2021\/11\/11\/":0},{"2021\/11\/10\/":0},{"2021\/11\/09\/":0},{"2021\/11\/08\/":0},{"2021\/11\/07\/":0},{"2021\/11\/06\/":0},{"2021\/11\/05\/":0},{"2021\/11\/04\/":0},{"2021\/11\/03\/":0},{"2021\/11\/02\/":0},{"2021\/11\/01\/":0},{"2021\/10\/31\/":0},{"2021\/10\/30\/":0},{"2021\/10\/29\/":0},{"2021\/10\/28\/":0},{"2021\/10\/27\/":0},{"2021\/10\/26\/":0},{"2021\/10\/25\/":0},{"2021\/10\/24\/":0},{"2021\/10\/23\/":0},{"2021\/10\/22\/":0},{"2021\/10\/21\/":0},{"2021\/10\/20\/":0},{"2021\/10\/19\/":0},{"2021\/10\/18\/":0},{"2021\/10\/17\/":0},{"2021\/10\/16\/":0},{"2021\/10\/15\/":0}],"chart_disk":[{"2021\/11\/13\/":114817},{"2021\/11\/12\/":0},{"2021\/11\/11\/":0},{"2021\/11\/10\/":0},{"2021\/11\/09\/":0},{"2021\/11\/08\/":0},{"2021\/11\/07\/":0},{"2021\/11\/06\/":0},{"2021\/11\/05\/":0},{"2021\/11\/04\/":0},{"2021\/11\/03\/":0},{"2021\/11\/02\/":0},{"2021\/11\/01\/":0},{"2021\/10\/31\/":0},{"2021\/10\/30\/":0},{"2021\/10\/29\/":0},{"2021\/10\/28\/":0},{"2021\/10\/27\/":0},{"2021\/10\/26\/":0},{"2021\/10\/25\/":0},{"2021\/10\/24\/":0},{"2021\/10\/23\/":0},{"2021\/10\/22\/":0},{"2021\/10\/21\/":0},{"2021\/10\/20\/":0},{"2021\/10\/19\/":0},{"2021\/10\/18\/":0},{"2021\/10\/17\/":0},{"2021\/10\/16\/":0},{"2021\/10\/15\/":0}]}

View File

@ -0,0 +1 @@
{"filename":"00cb28edee3be144f49dc7d643ee7153","date":"2021111322","total_time":"2021-11-13 22:00:30","dirnum":4,"filenum":6,"usage_space":"132.43KB","todayUpload":1,"yestUpload":0}

41
i/cache/verson.json vendored Executable file
View File

@ -0,0 +1,41 @@
{
"url": "https://api.github.com/repos/icret/EasyImages2.0/releases/52150405",
"assets_url": "https://api.github.com/repos/icret/EasyImages2.0/releases/52150405/assets",
"upload_url": "https://uploads.github.com/repos/icret/EasyImages2.0/releases/52150405/assets{?name,label}",
"html_url": "https://github.com/icret/EasyImages2.0/releases/tag/2.3.0",
"id": 52150405,
"author": {
"login": "icret",
"id": 16373024,
"node_id": "MDQ6VXNlcjE2MzczMDI0",
"avatar_url": "https://avatars.githubusercontent.com/u/16373024?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/icret",
"html_url": "https://github.com/icret",
"followers_url": "https://api.github.com/users/icret/followers",
"following_url": "https://api.github.com/users/icret/following{/other_user}",
"gists_url": "https://api.github.com/users/icret/gists{/gist_id}",
"starred_url": "https://api.github.com/users/icret/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/icret/subscriptions",
"organizations_url": "https://api.github.com/users/icret/orgs",
"repos_url": "https://api.github.com/users/icret/repos",
"events_url": "https://api.github.com/users/icret/events{/privacy}",
"received_events_url": "https://api.github.com/users/icret/received_events",
"type": "User",
"site_admin": false
},
"node_id": "RE_kwDOCzgjBc4DG8CF",
"tag_name": "2.3.0",
"target_commitish": "master",
"name": "EasyImage2.0 简单图床 ver:2.3.0",
"draft": false,
"prerelease": false,
"created_at": "2021-10-27T12:48:26Z",
"published_at": "2021-10-27T14:54:09Z",
"assets": [
],
"tarball_url": "https://api.github.com/repos/icret/EasyImages2.0/tarball/2.3.0",
"zipball_url": "https://api.github.com/repos/icret/EasyImages2.0/zipball/2.3.0",
"body": "* 2021-10-24 v2.3.0\r\n- 将服务器环境监测改为第一次打开时自动检测如需再次展示需删除config目录下的EasyImage.lock\r\n- 增加快捷操作中心显示服务信息\r\n- 增加自定义上传文件的命名方式详见config.php文件里的注释\r\n- 增加隐私政策、服务条款、DMCA\r\n- 增加自定义静态文件CDN源\r\n- 增加dns-prefetch\r\n- 删除了tinyfilemanager文件管理感觉没什么用\r\n- 一些bug得以修复"
}

45
public/static/echarts/echarts.common.min.js vendored Executable file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long