This commit is contained in:
icret
2022-09-20 13:44:48 +08:00
parent c6cd45425c
commit 4fae3bd291
13 changed files with 167 additions and 136 deletions

View File

@@ -45,11 +45,23 @@ Thumb::show($src, $w, $h);
*/
require_once __DIR__ . '/function.php';
// 自定义缩略图长宽
$thumbnail_w = 258;
$thumbnail_h = 258;
if (!empty($config['thumbnail_w']) || !empty($config['thumbnail_h'])) {
$thumbnail_w = $config['thumbnail_w'];
$thumbnail_h = $config['thumbnail_h'];
}
// 缓存时间
$cache_freq = $config['cache_freq'] * 60 * 60;
// 中文翻译 https://my.oschina.net/whrlmc/blog/81739
define('LOCAL_FILE_BASE_DIRECTORY', APP_ROOT);
define('MEMORY_LIMIT', '256M');
define('DEFAULT_WIDTH', 258);
define('DEFAULT_HEIGHT', 258);
define('DEFAULT_WIDTH', $thumbnail_w);
define('DEFAULT_HEIGHT', $thumbnail_h);
define('FILE_CACHE_PREFIX', 'EasyImage');
define('DEFAULT_ZC', 0);
@@ -59,10 +71,10 @@ define('FILE_CACHE_DIRECTORY', APP_ROOT . $config['path'] . 'thumbnails');
define('NOT_FOUND_IMAGE', $config['domain'] . '/public/images/404.png');
define('ERROR_IMAGE', $config['domain'] . '/public/images/404.png');
define('DISPLAY_ERROR_MESSAGES', false);
define('MAX_FILE_SIZE', $config['maxSize']); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。
define('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400); // 多久清理一次缓存
define('FILE_CACHE_MAX_FILE_AGE', 86400); // 文件必须从缓存中删除多长时间
define('BROWSER_CACHE_MAX_AGE', 864000); // 浏览器缓存时间
define('MAX_FILE_SIZE', $config['maxSize']); // 10 Megs 是 10485760。这是我们将处理的最大内部或外部文件大小。
define('FILE_CACHE_TIME_BETWEEN_CLEANS', $cache_freq); // 多久清理一次缓存
define('FILE_CACHE_MAX_FILE_AGE', $cache_freq); // 文件必须从缓存中删除多长时间
define('BROWSER_CACHE_MAX_AGE', $cache_freq); // 浏览器缓存时间
global $ALLOWED_SITES;
$ALLOWED_SITES = array(