2010-11-09 76 views
0

這裏是我的網站,timthumb不工作:「http://vitinh.cz/?page_id=8」 我已經嘗試了許多解決方案,但沒有....我也用你的(http://andrewroycarter.com/wordpress-2/using-timthumb-on-wordpress-multi-user/) 但是我不能讓它工作無論如何:(你能幫我解決它嗎?謝謝。 我等待着你的答案。在WordPress上使用timthumb,仍然不工作:((。幫助,請

(WordPress版本3.0.1)

+2

「不工作」 是*不*一個問題描述。沒有你做一些調試,並告訴我們你遇到困難的具體細節就不可能回答這個問題。 – deceze 2010-11-09 14:30:34

回答

3

的問題是,你要使用timthumb.php來調整不在您的服務器上的圖像。

對縮放後的圖像實際的錯誤是這樣的:

remote host "ongmat.cz" not allowed TimThumb version : 1.14

解決方法是編輯timthumb.php腳本,並進行了更改線24(或接近)

// external domains that are allowed to be displayed on your website 
$allowedSites = array (
     'flickr.com', 
     'picasa.com', 
     'blogger.com', 
     'wordpress.com', 
     'img.youtube.com', 
); 

,並添加您要使用的圖像,如添加ongmat.cz到陣列的領域,所以它看起來是這樣的:

$allowedSites = array (
       'flickr.com', 
       'picasa.com', 
       'blogger.com', 
       'wordpress.com', 
       'img.youtube.com', 
     'ongmat.cz', 
     ); 

或你可以改變這個選項(雖然不是安全)

define ('ALLOW_EXTERNAL', FALSE);      // allow external website (override security precaution) 

和FALSE更改爲TRUE

第30行應該是這樣的:

/** 
* TimThumb script created by Ben Gillbanks, originally created by Tim McDaniels and Darren Hoyt 
* http://code.google.com/p/timthumb/ 
* 
* GNU General Public License, version 2 
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
* 
* Examples and documentation available on the project homepage 
* http://www.binarymoon.co.uk/projects/timthumb/ 
*/ 

define ('CACHE_SIZE', 250);          // number of files to store before clearing cache 
define ('CACHE_CLEAR', 5);          // maximum number of files to delete on each cache clear 
define ('CACHE_USE', FALSE);       // use the cache files? (mostly for testing) 
define ('VERSION', '1.16');          // version number (to force a cache refresh) 
define ('DIRECTORY_CACHE', './cache');   // cache directory 
define ('DIRECTORY_TEMP', './temp');   // temp directory 
define ('MAX_WIDTH', 1000);          // maximum image width 
define ('MAX_HEIGHT', 1000);       // maximum image height 
define ('ALLOW_EXTERNAL', TRUE);      // allow external website (override security precaution) 

// external domains that are allowed to be displayed on your website 
$allowedSites = array (
     'flickr.com', 
     'picasa.com', 
     'blogger.com', 
     'wordpress.com', 
     'img.youtube.com', 
     'ongmat.cz', 
); 
+0

嗨,我剛剛嘗試過你的解決方案,但仍然沒有結果:(( – Tony 2010-11-09 20:15:11

+0

)然後你可能做錯了什麼,這肯定是問題,因爲我以前有過,你能發佈這個文件的前30行:http://vitinh.cz/wp-content/themes/vitinh/timthumb.php – gteh 2010-11-09 21:03:20

+0

if(!function_exists('imagecreatetruecolor')){ displayError('GD Library Error:imagecreatetruecolor does not exist - please contact your webhost and ('CACHE_CLEAR',5); define('VERSION','1.14'); define('DIRECTORY_CACHE', './cache'); define('DIRECTORY_TEMP','./temp'); $ allowedSites = array( 'flickr.com 」, 'picasa.com', 'blogger.com', 'wordpress.com', 'img.youtube.com', 'ongmat.cz', ); 對不起,我不能發佈像你 – Tony 2010-11-09 21:22:08

相關問題