图片传输到新服务器后损坏


Pictures Broken After Transferring To New Server

我有一个使用shopp电子商务插件的WordPress网站,我从MediaTemple移动到HostGator VPS。

链接:http://www.shop.deltagrooveproductions.com

在我把图片转移到商店后,所有的图片都坏了。当您尝试在新选项卡中打开图像时,有PHP错误。此链接例如:http://www.shop.deltagrooveproductions.com/shop/images/2338/TerryHank_GottaBringItOnHomeToYou_AlbumArt.png

有图片存储在数据库中,但我不知道为什么他们没有加载,现在我转移。

下面是Assets.php的源代码

class FileAsset extends MetaObject {
var $mime;
var $size;
var $storage;
var $uri;
var $context = 'product';
var $type = 'asset';
var $_xcols = array('mime','size','storage','uri');
function __construct ($id=false) {
    $this->init(self::$table);
    $this->extensions();
    if (!$id) return;
    $this->load($id);
    if (!empty($this->id))
        $this->expopulate();
}

/**
 * Populate extended fields loaded from the MetaObject
 *
 * @author Jonathan Davis
 * @since 1.1
 *
 * @return void
 **/
function expopulate () {
    parent::expopulate();
    $this->uri = stripslashes($this->uri);
}
/**
 * Store the file data using the preferred storage engine
 *
 * @author Jonathan Davis
 * @since 1.1
 *
 * @return void
 **/
function store ($data,$type='binary') {
    $Engine = $this->_engine();
    $this->uri = $Engine->save($this,$data,$type);
    if ($this->uri === false) return false;
    return true;
}
/**
 * Retrieve the resource data
 *
 * @author Jonathan Davis
 * @since 1.1
 *
 * @return void
 **/
function retrieve () {
    $Engine = $this->_engine();
    return $Engine->load($this->uri);
}
/**
 * Retreive resource meta information
 *
 * @author Jonathan Davis
 * @since 1.1
 *
 * @return void
 **/
function readmeta () {
    $Engine = $this->_engine();
    list($this->size,$this->mime) = array_values($Engine->meta($this->uri,$this->name));
}
/**
 * Determine if the resource exists
 *
 * @author Jonathan Davis
 * @since 1.1
 *
 * @return void
 **/
function found ($uri=false) {
    if (!empty($this->data)) return true;
    if (!$uri) $uri = $this->uri;
    $Engine = $this->_engine();
    return $Engine->exists($uri);
}
/**
 * Determine the storage engine to use
 *
 * @author Jonathan Davis
 * @since 1.1
 *
 * @return void Description...
 **/
function &_engine () {
    global $Shopp;
    if (!isset($Shopp->Storage)) $Shopp->Storage = new StorageEngines();
    if (!empty($this->storage)) {
        // Use the storage engine setting of the asset
        if (isset($Shopp->Storage->active[$this->storage])) {
            $Engine = $Shopp->Storage->active[$this->storage];
        } else if (isset($Shopp->Storage->modules[$this->storage])) {
            $Module = new ModuleFile(SHOPP_STORAGE,$Shopp->Storage->modules[$this->storage]->filename);
            $Engine = $Module->load();
        }
    } elseif (isset($Shopp->Storage->engines[$this->type])) {
        // Pick storage engine from Shopp-loaded engines by type of asset
        $engine = $Shopp->Storage->engines[$this->type];
        $this->storage = $engine;
        $Engine = $Shopp->Storage->active[$engine];
    }
    if (!empty($Engine)) $Engine->context($this->type);
    return $Engine;
}
/**
 * Stub for extensions
 *
 * @author Jonathan Davis
 * @since 1.1
 *
 * @return void
 **/
function extensions () {}
} // END class FileAsset
/**
 * ImageAsset class
 *
 * A specific implementation of the FileAsset class that provides helper
 * methods for imaging-specific tasks.
 *
 * @author Jonathan Davis
 * @since 1.1
 * @package shopp
 **/
class ImageAsset extends FileAsset {
// Allowable settings
var $_scaling = array('all','matte','crop','width','height');
var $_sharpen = 500;
var $_quality = 100;
var $width;
var $height;
var $alt;
var $title;
var $settings;
var $filename;
var $type = 'image';
function output ($headers=true) {
    if ($headers) {
        $Engine = $this->_engine();
        $data = $this->retrieve($this->uri);
        $etag = md5($data);
        $offset = 31536000;
        if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
            if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $this->modified ||
                trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
                header("HTTP/1.1 304 Not Modified");
                header("Content-type: {$this->mime}");
                exit;
            }
        }
        header("Cache-Control: public, max-age=$offset");
        header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $offset ) . ' GMT');
        header('Last-Modified: '.date('D, d M Y H:i:s', $this->modified).' GMT');
        if (!empty($etag)) header('ETag: '.$etag);
        header("Content-type: $this->mime");
        $filename = empty($this->filename) ? "image-$this->id.jpg" : $this->filename;
        header('Content-Disposition: inline; filename="'.$filename.'"');
        header("Content-Description: Delivered by WordPress/Shopp Image Server ({$this->storage})");
    }

任何想法?

您可以通过重新保存永久链接来解决这个问题。在更新、转移Shopp后,这通常是必要的。

您应该考虑从数据库存储改为文件存储。在数据库中有很多图像并不是一个好主意。它也比较慢。

有一个免费的插件可以帮助你。在进行这样的更改之前,请务必备份文件和数据库