Thumbnails not showing on live site
-
On my homepage I am showing thumbnails and title from a list of posts from a particular category.
The problem is it works fine on my local machine but doesn’t work on my live site.
in functions.php I have:
function get_the_thumbnail() { $files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image'); if($files) : $keys = array_reverse(array_keys($files)); $j=0; $num = $keys[$j]; $image=wp_get_attachment_image($num, 'large', false); $imagepieces = explode('"', $image); $imagepath = $imagepieces[1]; $thumb=wp_get_attachment_thumb_url($num); print "<img src='$thumb' class='thumbnail' />"; endif; }
it’s called in page.php (homepage) is:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (is_front_page()) { query_posts('cat=19&showposts=12'); } ?> <div class="image-box" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink(); ?>"> <?php get_the_thumbnail(); ?> <p><?php the_title(); ?></p> </a> </div> <?php endwhile; endif; ?>
As I say it works fine on my local machine. The images do exist, it’s just the html doesn’t display.
The output should be (locally):
<a href="https://127.0.0.1/~mysite/mysite/?p=931"> <img class="thumbnail" src="https://127.0.0.1/~mysite/mysite/wp-content/uploads/2010/03/38_okgoposalbum-140x140.gif"> <p>OK GO Album cover</p> </a>
but on my site I get:
<a href="https://www.mysite.com/?p=931"> <p>OK GO Album cover</p> </a>
It’s completely stumped me. I’ve tried alternative thumbnail plugins like get-the-image and it also fails to show thumbnails online (they show locally). I’ve changed permissions of the upload folder and all the images inside.
What could be the problem? I’m so close!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Thumbnails not showing on live site’ is closed to new replies.