添加恢复链接
parent
c326f6b97f
commit
95574a35d5
|
@ -65,6 +65,7 @@ RewriteRule config/(.*).(php)$ – [F]
|
|||
- 或者参考:[https://www.545141.com/981.html](https://www.545141.com/981.html)
|
||||
|
||||
<details><summary><mark><font color=darkred>点击查看2.0版更新日志</font></mark></summary>
|
||||
|
||||
* 2021年10月30日
|
||||
- 增加监黄接口
|
||||
- 增加对php5.6-php8.0的支持
|
||||
|
|
|
@ -36,6 +36,12 @@ if (isset($_POST['delDir'])) {
|
|||
header("refresh:1;"); // 1s后刷新当前页面
|
||||
}
|
||||
}
|
||||
// 恢复图片
|
||||
if(isset($_GET['reimg'])){
|
||||
$name = $_GET['reimg'];
|
||||
re_checkImg($name);
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -145,12 +151,12 @@ if (isset($_POST['delDir'])) {
|
|||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="type" value="Imgcompress" checked="checked"> 使用本地压缩(默认上传已压缩的,不需重复压缩)
|
||||
<input type="radio" name="type" value="Imgcompress" checked="checked"> 使用本地压缩(默认上传已压缩,不需重复压缩)
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="type" value="TinyImg"> 使用tinypng压缩(申请key:<a href="https://tinypng.com/" target="_blank">https://tinypng.com/</a>
|
||||
<input type="radio" name="type" value="TinyImg"> 使用TinyImag压缩(需要申请key)
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -193,7 +199,7 @@ if (isset($_POST['delDir'])) {
|
|||
</div>
|
||||
<div class="col-md-12">
|
||||
<hr>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-7">
|
||||
<p>
|
||||
<button type="button" class="btn" data-toggle="collapse" data-target="#lis_cache">疑似违规的图片<i class="icon icon-hand-down"></i></button>
|
||||
</p>
|
||||
|
@ -211,6 +217,7 @@ if (isset($_POST['delDir'])) {
|
|||
<th>长宽(像素)</th>
|
||||
<th>大小</th>
|
||||
<th>查看图片</th>
|
||||
<th>还原图片</th>
|
||||
<th>删除图片</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -227,7 +234,7 @@ if (isset($_POST['delDir'])) {
|
|||
@$filen_name = $cache_file[$i]; // 图片名称
|
||||
@list($width, $height, $type, $attr) = getimagesize($file_cache_path); // 图片长、宽、类型、属性
|
||||
$url = $config['imgurl'] . $config['path'] . 'cache/' . $cache_file[$i]; // 图片网络连接
|
||||
$unlink_url = $config['domain'] . '/api/del.php?url=' . $url; // 图片删除连接
|
||||
$unlink_img = $config['domain'] . '/api/del.php?url=' . $url; // 图片删除连接
|
||||
// 缩略图文件
|
||||
$thumb_cache_file = $config['domain'] . '/libs/thumb.php?img=' . $file_path . '&width=300&height=300';
|
||||
echo '
|
||||
|
@ -238,7 +245,8 @@ if (isset($_POST['delDir'])) {
|
|||
<td>' . $height . '*' . $width . '</td>
|
||||
<td>' . $file_size . '</td>
|
||||
<td><a class="btn btn-mini" href="' . $url . '" target="_blank">查看原图</a></td>
|
||||
<td><a class="btn btn-mini btn-danger" href="' . $unlink_url . '" target="_blank">删除图片</a></td>
|
||||
<td><a class="btn btn-mini btn-success" href="?reimg='.$filen_name.'">恢复图片</a></td>
|
||||
<td><a class="btn btn-mini btn-danger" href="' . $unlink_img . '" target="_blank">删除图片</a></td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
|
|
|
@ -179,7 +179,9 @@ $config = array(
|
|||
* 从 https://moderatecontent.com/ 获取key并填入/config/api_key.php的图片检查key
|
||||
* 开启后会受服务器到https://moderatecontent.com/ 速度影响,国内不建议开启!
|
||||
*/
|
||||
'checkImg' => false,
|
||||
'checkImg' => true,
|
||||
// 设置是不良图片概率,概率越大准确率越高,
|
||||
'checkImg_value' => 50,
|
||||
// 当前版本
|
||||
'version' => '2.3.1',
|
||||
'version' => '2.3.1'
|
||||
);
|
||||
|
|
2
file.php
2
file.php
|
@ -120,7 +120,7 @@ if ($handle->uploaded) {
|
|||
|
||||
if($config['checkImg']){
|
||||
require_once APP_ROOT . '/config/api_key.php';
|
||||
@checkImg($imageUrl);
|
||||
checkImg($imageUrl);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -619,17 +619,16 @@ function get_json($img)
|
|||
$output = json_decode($output, true);
|
||||
return $output;
|
||||
}
|
||||
|
||||
// 检查图片是否违规
|
||||
function checkImg($imageUrl)
|
||||
function checkImg($imageUrl, $mode = true)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$response = get_json($imageUrl);
|
||||
if ($response['rating_index'] == '3') { // (1 = everyone, 2 = teen, 3 = adult)
|
||||
|
||||
if ($response['rating_index'] == 3 or $response['predictions']['adult'] > $config['checkImg_value']) { // (1 = everyone, 2 = teen, 3 = adult)
|
||||
$old_path = APP_ROOT . parse_url($imageUrl)['path']; // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png
|
||||
$name = basename($imageUrl); // 文件名 p8vypd.png
|
||||
//$name = date('Y_m_d').'_'.basename($imageUrl); // 文件名 p8vypd.png
|
||||
$name = date('Y_m_d') . '_' . basename($imageUrl); // 文件名 2021_10_30_p8vypd.png
|
||||
$new_path = APP_ROOT . $config['path'] . 'cache/' . $name; // 新路径含文件名
|
||||
$cache_dir = APP_ROOT . $config['path'] . 'cache/'; // cache路径
|
||||
|
||||
|
@ -641,3 +640,14 @@ function checkImg($imageUrl)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 还原被审查的图片
|
||||
function re_checkImg($name)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$now_file = str_replace('_', '/', $name); // 当前图片相对位置 2021/10/30/p8vypd.png
|
||||
$now_path_file = APP_ROOT . $config['path'] . 'cache/' . $name; // 当前图片绝对位置 */i/cache/2021_10_30_p8vypd.png
|
||||
$to_file = APP_ROOT . $config['path'] . $now_file; // 还原图片的绝对位置 */i/2021/10/30/p8vypd.png
|
||||
rename($now_path_file, $to_file);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue