timthumb 在站点迁移后无法工作

问题描述 投票:0回答:2

我刚刚从 xfactorapp.com 移动我的网站,任何新上传的图片都没有缩略图。图像在服务器上,但未生成缩略图。

如何更改该代码以使缩略图在新服务器上可见?

function href_timthumb($file, $set = null, $xf = true) {
if (!$set || !$xf) {
    $timthumb = webpath_assets('/timthumb.php');
    $href = $timthumb . '?src=' . $file;
    if (xcount($set) > 0) {
        foreach ($set as $k => $v) {
            $href .= '&' . $k . '=' . $v;
        }
    }
    return $href;
} else {
    $param['w'] = 150;
    $param['h'] = 150;
    $param['zc'] = 0;
    $param['q'] = 90;
    if (DEV) {
        $app = DEV_PREFIX . APP_VERSION;
    } else {
        $app = LIVE_PREFIX . APP_VERSION;
    }
    if (xcount($set) > 0) {
        foreach ($set as $k => $v) {
            $param[$k] = $v;
        }
        $file = '/' . $app . $file;
        $protocol = 'http';
        if (isSSL()) {
            $protocol = 'https';
        }
return $protocol . '://thumb.xfactorapp.com/tt/' . implode('/', $param) . $file;
    }
}
}

这给了我:

<img class="img-responsive" alt="building" src="http://thumb.xfactorapp.com/tt/263/147/2/90/v3/uploads/_lifttec/cms/58529051881f8f0d87ab1401/5947fffeac28b_200-ATJ-Platforma-autoridicatoare-articulata.jpg">

我希望更改代码以获取具有参数属性的缩略图,但从上传而不是从thumb.xfactorapp.com

谢谢

migration thumbnails timthumb
2个回答
0
投票

只需将 $xf 从 true 更改为 false $xf = false。


0
投票

如果您更换了服务器,可能是 GD 库丢失,所以安装并重新启动 Apache,然后检查您的文件权限

//安装GD库

sudo apt-get install php5.6-gd

// 重新启动 Apache2

sudo /etc/init.d/apache2 restart

© www.soinside.com 2019 - 2024. All rights reserved.