timthumb在站点迁移后无法正常工作

时间:2017-06-20 09:39:48

标签: migration thumbnails timthumb

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

如何更改该代码以使新服务器显示缩略图?

function href_t`imthumb($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">

我希望更改代码以使用parnam属性获取缩略图,但不是从thumb.xfactorapp.com上传

由于

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

如果您更改了服务器,可能缺少GD库,因此安装并重新启动Apache,然后检查您的文件权限

//安装GD库

sudo apt-get install php5.6-gd

//重启Apache2

sudo /etc/init.d/apache2 restart