3

このバージョンの Timthum で次の問題が発生しています: 2.8.10 (Wordpress インストールで実行 - サーバー Ubuntu):

- Web サイトをホストしているサーバーから画像を呼び出すと、次のエラーが発生しました。

TimThumb エラーが発生しました 次のエラーが発生しました:

Could not find the internal image you specified.

クエリ文字列: src=http://my-host.it/wp-content/files_mf/1346848579prog_no_pic.png TimThumb バージョン: 2.8.10

http://my-host.it/wp-content/files_mf/1346848579prog_no_pic.pngをブラウザーにコピー/貼り付けすると、画像を取得できます...

- 外部サイトから画像を呼び出すと正常に動作します。 有効にしました:

define ('ALLOW_ALL_EXTERNAL_SITES', TRUE);

33行目。

4

5 に答える 5

3

私の場合、仮想ホストのセットアップが原因で、ドキュメント ルートが正しく設定されていませんでした。

正しいものを追加する必要がありましたtimthumb-config.php

define('LOCAL_FILE_BASE_DIRECTORY', "/home/www/mysite/");
于 2013-03-06T18:27:22.893 に答える
2

この2つのステップは私にとってうまくいきました:

  • 行 ~33 で真のALLOW_ALL_EXTERNAL_SITES に設定します。

if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) define ('ALLOW_ALL_EXTERNAL_SITES', TRUE);

  • コメント行 ~212

//$this->src = preg_replace('/https?:\/\/(?:www\.)?' . $this->myHost . '/i', '', $this->src);


ソース: https://code.google.com/p/timthumb/issues/detail?id=363#c23

于 2014-08-04T20:39:44.113 に答える
1

WordPress (3.5.1) のマルチサイト インストールでも同じ問題が発生しました。以下はそれを修正しました:

functions.phpで変更

function get_image_url($img_src="") {
if($img_src!="") $theImageSrc = $img_src;
else $theImageSrc = wp_get_attachment_url(get_post_thumbnail_id($post_id));
global $blog_id;
if (isset($blog_id) && $blog_id > 0) {
    $imageParts = explode('/files/', $theImageSrc);
    if (isset($imageParts[1])) {
        $theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
    }
}
echo $theImageSrc;

}

function get_image_url($img_src="") {
if($img_src!="") $theImageSrc = $img_src;
else $theImageSrc = strstr(wp_get_attachment_url(get_post_thumbnail_id($post_id)), "/wp-content");
global $blog_id;
if (isset($blog_id) && $blog_id > 0) {
    $imageParts = explode('/files/', $theImageSrc);
    if (isset($imageParts[1])) {
        $theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
    }
}
echo $theImageSrc;

}

注:実際の変更は 3 行目 (太字) のみです: $theImageSrc = strstr ( wp_get_attachment_url(get_post_thumbnail_id($post_id)) , "/wp-content") ;

于 2013-02-24T22:07:27.560 に答える
1

私の場合、ファイルパスにチルダが含まれていることに関係していたこの問題を乗り越えました。

私が見つけた解決策のリンクは次のとおりです。

http://elementdesignllc.com/2012/01/how-to-fix-timthumb-using-a-virtual-directory-url-contains-tildes/comment-page-1/#comment-7418

チッ!

于 2012-12-18T00:37:31.130 に答える
0

First let me know are you using WordPress Multisite? If yes then you dont need edit anything in timthumb.php me do like it

This is what I have done to get timthumb to work with multisite. You need to add this code to your theme's functions.php file

<?php function get_image_path($src) {
global $blog_id;
if(isset($blog_id) && $blog_id > 0) {
$imageParts = explode('/files/' , $src);
if(isset($imageParts[1])) {
$src = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
}
}
return $src;
}
?>

And then where the timthumb script is used in the theme, you need to modify to this:

<img src="<?php bloginfo('template_url'); ?>/includes/timthumb.php?q=100&w=180&h=200&zc=1&a=t&src=<?php echo get_image_path(get_post_meta($post->ID, 'postImage', true)); ?>" alt="" />

where postImage is the name of the meta field the holds the image URL.

have a nice.

于 2012-12-05T22:33:04.980 に答える