I'm building a site using wordpress installed on localhost.
For some reason my post.php page is not displaying post thumbnails (featured images). I have identified that it is a problem with timthumb.php which is not correctly locating the image url. I have searched for hours online and tried a number of solutions but nothing seems to be working.
The basic problem is I think in this line in my blog.php file:
<?php
if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>"><img class="postimg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=200&w=470&zc=1" alt=""/></a>
<?php }
else { ?>
<a href="<?php the_permalink() ?>"><img class="postimg" src="<?php bloginfo('template_directory'); ?>/images/dummy.png" alt="" /></a>
<?php } ?>
My functions.php script defines get_image_url as follws:
function get_image_url(){
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id,'large');
$image_url = $image_url[0];
echo $image_url;
}
In the site it returns the dummy.png image (broken image) - when I right click the image and open in a new tab the error I get is:
"A Timthumb Error has occurred - Cannot find the internal image that you specified"
It then shows my query string:
Query String : src=http://localhost/wordpress/frouzeh/wp-content/uploads/sites/3/2013/04/PurpleNecklace.png&h=200&w=470&zc=1
however if I actually go to the image using the URL:
http://localhost/wordpress/frouzeh/wp-content/uploads/sites/3/2013/04/PurpleNecklace.png
the image show up fine
I have enabled (as some solutions suggest in the timthumb.php file):
define ('ALLOW_ALL_EXTERNAL_SITES', TRUE);
There is no tilde in my site name as other solutions suggest.
I'm really at a loss here. And would appreciate any help - seems like it may be a simple syntax error or something but I can't find it.
After trying to fix this for hours, I decided to move my wordpress site to a live server (linux). I then changed the access permissions to the Cache folder to 755 and my images came back.
This was a permission problem, however I am still unsure why it wouldn't work on my windows machine even after going through properties of the cache folder and changing the permissions there - any insight would be appreciated...