官方论坛产品帮助刷图视频问题反馈

为Chevereto静态资源使用腾讯云对象存储

发表于 秦海传媒

    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;
    }

  • 此条目发表在 闲言碎语 分类目录。将固定链接加入收藏夹。

Google ADs

除非另有声明,本站文章遵循知识共享署名-非商业性使用 2.5 中国大陆许可协议。 Copyright © 2008-2012 99288.NET.CN.