Reputation: 1043
I am having the following issue with this version of Timthum: 2.8.10 (running on Wordpress installation - server Ubuntu):
- When i call images from the server hosting the website i got this error:
A TimThumb error has occured The following error(s) occured:
Could not find the internal image you specified.
Query String : src=http://my-host.it/wp-content/files_mf/1346848579prog_no_pic.png TimThumb version : 2.8.10
If i copy/paste http://my-host.it/wp-content/files_mf/1346848579prog_no_pic.png in the browser i can get the image...
- When i call image from external sites it works fine. I have enabled:
define ('ALLOW_ALL_EXTERNAL_SITES', TRUE);
at line 33.
Upvotes: 3
Views: 13962
Reputation: 3834
This two steps worked for me:
if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) define ('ALLOW_ALL_EXTERNAL_SITES', TRUE);
//$this->src = preg_replace('/https?:\/\/(?:www\.)?' . $this->myHost . '/i', '', $this->src);
Source: https://code.google.com/p/timthumb/issues/detail?id=363#c23
Upvotes: 2
Reputation: 13812
For me, the document root wasn't being set correctly, due to my virtual host setup.
I had to add the correct one in timthumb-config.php
define('LOCAL_FILE_BASE_DIRECTORY', "/home/www/mysite/");
Upvotes: 3
Reputation: 356
I had the same problem on a Multisite installation of WordPress (3.5.1). The following fixed it:
In functions.php change
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;
}
to
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;
}
Note: The only actual modification happens in the 3rd line (bold): $theImageSrc = strstr( wp_get_attachment_url(get_post_thumbnail_id($post_id)) , "/wp-content");
Upvotes: 1
Reputation: 982
I just got over this problem which, in my case, had to do with the file path having a tilde in it.
Here's a link the solution I found:
HTH!
Upvotes: 1
Reputation: 447
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.
Upvotes: 0