SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Link Not Parsing Correctly in Image Tags. Any ideas?

    Hi,
    I'm having a problem which is confusing the hell out of me. I worked out a path, which has a number of variables below, and then tried to echo it out as the source of an image. When I do this the image source is only echoing the first part, i.e. the stylesheet directory, and nothing after, and so the image is not displaying. I've tried echo'ing the $path value and it looks perfect, it's just when I use it as the image source it's only displaying the first part. Why is this?

    Code:
    $path = bloginfo( 'stylesheet_directory' ) . "/libs/timthumb.php?w=140&q=100&src=" . get_post_meta($post->ID, 'image', true);
    
    echo $path;					
    
    <img src="<?php echo $path; ?>" class="what-image" />

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,217
    Mentioned
    457 Post(s)
    Tagged
    8 Thread(s)
    Probably not the problem, but what happens if you change from double to single quotes?

    I.e. changing

    "/libs/timthumb.php?w=140&q=100&src="

    to

    '/libs/timthumb.php?w=140&q=100&src='

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, thanks for the suggestion. I figured it out though. I needed to use 'get_bloginfo' instead of just 'bloginfo', so with 'get_bloginfo( 'stylesheet_directory' )' it worked perfectly.

    Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •