WordPress print_thumbnail not giving correct url

I’ve been having a hard time with this issue.
I’m running WordPress 3.3.1 on Ubuntu Server 64bit

So I’m able to upload an image and view it using the url provided.
However, when I set it as a feature image it appears that the function
print_thumbnail is not giving me the correct address.
It’s adding in /var/www/ before my /wp-content/uploads/etc…
So the absolute path name would be correct on my machine with the help of some symlinks.

Read More

I tried changing the css on the file to remove the /var/www/ and verified that this did indeed find my image and worked. I’ve been seeing a lot of posts that tell me change chmod 777 and back to 755 as in wp print_thumbnail function is not working and https://stackoverflow.com/questions/9003277/wp-print-thumbnail-function-not-working-correctly I don’t know how this was suppose to fix the issue since this seems to be a pathing problem. Is there some sort of redirection based on permissions? Anyways, it didn’t work.

Does anyone have any ideas?

Here is an example post
http://mobile.cs.fsu.edu/google-chrome-app-on-android-market/

Related posts

Leave a Reply

2 comments

  1. You might try this instead of print_thumbnail.

    <?php
    if ( has_post_thumbnail() ) {
        the_post_thumbnail(); // Outputs <img/> object with src="thumbnail-href"
    }
    

    Similarly, this would also work:

    <?php
    if ( has_post_thumbnail() ) {
        echo( get_the_post_thumbnail( get_the_ID() ) );
    }
    

    If you’ve setup multiple featured image sizes in your functions.php….

    <?php
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 120, 120 );
    add_image_size( 'subfeature', 940, 300 );
    

    you could reference a size in this manner (where subfeature is the name of the size):

    <?php
    if ( has_post_thumbnail() ) {
        echo( get_the_post_thumbnail( get_the_ID(), 'subfeature' ) );
    }
    
  2. In the function I found out that it uses get_bloginfo function to print out stylesheet directory

    $output = '<img src="'.get_bloginfo('stylesheet_directory').'/timthumb.php?src='.$thumbnail.'&amp;h='. $height .'&amp;w='. $width .'&amp;zc=1"';
    

    In the wordpress codex of get_bloginfo, it says:

    ‘stylesheet_directory’ – Returns the stylesheet directory URL of the
    active theme. (Was a local path in earlier WordPress versions.)
    Consider using get_stylesheet_directory_uri() instead.

    Change the get_bloginfo(‘stylesheet_directory’) to get_stylesheet_directory_uri()

    I did not try it myself, hope it helps.