• I’m using the following code in an effort to generate a TimThumb cropped version of the featured image to appear at the top of the content area:

    <div class="single-thumb">
        <?php $thumbFeatured = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'featured-thumb'); ?>
        <img src="timthumb.php?src=<?php echo $thumbFeatured[0]; ?>&h=300&w=620" alt="<?php the_title(); ?>" width='620' height="300" />
    </div>

    The original code used in the theme worked fine but forced the image to be a certain proportion which looked terrible on many images. So all I added was the src="timthumb.php? in front of the previous src declaration, and of course adding the width and height references for TimThumb to apply. TimThumb.php is located at the document root level of the theme (the same as the single.php file that references this script), so it should work, but generates only a border in the given size with the alt tag.

    What am I doing wrong?

Viewing 1 replies (of 1 total)
  • Thread Starter Adwiz

    (@adwiz)

    I figured it out. TimThumb can’t deal with the relative path. So I changed it to <img src="<?php echo get_template_directory_uri(); ?>/timthumb.php?src=<?php etc... and it works fine.

Viewing 1 replies (of 1 total)

The topic ‘Need help with TimThumb image path reference’ is closed to new replies.