Change Chevereto statics to anothoer url
https://chevereto.com/community/threads/how-to-change-statics-to-anothoer-url.12479/#post-63586
为Chevereto静态资源使用腾讯云对象存储,提高网站加载速度。
示例站点:http://pic.qinhai.us
Add this line at app/settings.php
define('qinhai_host','http://pic.qinhai.us');
define('static_host','https://qinhai-1302838987.cos.ap-beijing.myqcloud.com');
change app/lib/classes/class.image.php at 1332
if(qinhai_host){
$url=parse_url ($display['url']);
$image['display_url']= qinhai_host.$url['path'];
}else{
$image['display_url'] = $display['url'];
}
//$image['display_url'] = $display['url'];
修改 app/lib/functions.render.php 的get_static_url函数
function get_static_url($filepath, $options = []){
$options = array_merge(['versionize' => true, 'minify' => null], $options);
if ($options['minify'] !== false) {
$filepath = get_cond_minified_file($filepath, $options['forced']); // Handle the conditional minify
}
$return = G\absolute_to_url($filepath, defined('CHV_ROOT_URL_STATIC') ? CHV_ROOT_URL_STATIC : null);
if ($options['versionize']) {
$return = versionize_src($return);
}
//add by osiris 3 lines
if(static_host){
$url=parse_url ($return);
$return = static_host.$url['path'];
}
//add end
return $return;
}
最新评论