You've already forked EasyImages2.0
mirror of
https://github.com/icret/EasyImages2.0.git
synced 2025-12-16 11:53:58 +08:00
优化和修复bugs
This commit is contained in:
@@ -1623,10 +1623,14 @@ function process_checkImg($imgurl)
|
||||
* $fileSize 图片的大小
|
||||
* $form 来源如果是网页上传直接显示网页,如果是API上传则显示ID
|
||||
*/
|
||||
function write_log($filePath, $sourceName, $absolutePath, $fileSize, $from = "web")
|
||||
function write_upload_logs($filePath, $sourceName, $absolutePath, $fileSize, $from = "web")
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (!$config['upload_logs']) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$checkImg = $config['checkImg'] == true ? "ON" : "OFF";
|
||||
|
||||
// $name = trim(basename($filePath), " \t\n\r\0\x0B"); // 当前图片名称
|
||||
@@ -1718,12 +1722,14 @@ function ip2region(String $IP)
|
||||
*/
|
||||
function ip_upload_counts()
|
||||
{
|
||||
$dir = APP_ROOT . '/admin/logs/ipcounts/';
|
||||
global $config;
|
||||
|
||||
if (!is_dir($dir)) {
|
||||
mkdir($dir, 0777);
|
||||
if ($config['ip_upload_counts'] > 0) {
|
||||
|
||||
$dir = APP_ROOT . '/admin/logs/ipcounts/';
|
||||
if (!is_dir($dir)) mkdir($dir, 0777);
|
||||
|
||||
$file = $dir . date('Ymd') . '.php';
|
||||
file_put_contents($file, real_ip() . PHP_EOL, FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
|
||||
$file = $dir . date('Ymd') . '.php';
|
||||
file_put_contents($file, real_ip() . PHP_EOL, FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
|
||||
@@ -213,20 +213,18 @@ if ($handle->uploaded) {
|
||||
// 同IP上传日志
|
||||
@ip_upload_counts();
|
||||
// 日志
|
||||
if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
|
||||
@write_upload_logs($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
|
||||
// 鉴黄
|
||||
@process_checkImg($processUrl);
|
||||
// 日志
|
||||
if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
|
||||
// 水印
|
||||
@water($handle->file_dst_pathname);
|
||||
// 压缩
|
||||
@ip_upload_counts();
|
||||
@process_compress($handle->file_dst_pathname);
|
||||
} else { // 普通模式
|
||||
// 记录同IP上传次数
|
||||
@ip_upload_counts();
|
||||
// 日志
|
||||
if ($config['upload_logs']) @write_log($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
|
||||
@write_upload_logs($pathIMG, $handle->file_src_name, $handle->file_dst_pathname, $handle->file_src_size);
|
||||
// 鉴黄
|
||||
@process_checkImg($processUrl);
|
||||
// 水印
|
||||
|
||||
Reference in New Issue
Block a user