• Hi, I hope anyone can help me.I try to integrate timthumb.php and lightbox 2 to my site but unfortunately The image is not displaying inside the lightbox a broken image icon was appearing….here is my code

    ` <div id=”content-wrapper”>
    <div id=”column_01″>
    <?php /*?>// FIRST LOOP: display posts 1 thru 5<?php */?>
    <?php query_posts(‘showposts=5’); ?>
    <?php $posts = get_posts(‘numberposts=4&offset=0’); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count1 = 0; if ($count1 == “4”) { break; } else { ?>
    <div class=”thumbnail”>
    <a href=”<?php the_permalink(); ?>” class=”lightbox” title=”<?php the_title_attribute(); ?>”>
    <img src=”<?php bloginfo(‘template_directory’); ?>/timthumb.php?src=<?php getImage(‘1’); ?>&w=270&h=140&zc=1″>
    </a>
    </div>
    <?php #the_content(); ?>

    <?php $count1++; } ?>
    <?php endforeach; ?>
    </div>
    <div id=”column_wrap”>
    <div id=”column_02″>
    <?php /*?>// SECOND LOOP: display posts 6 thru 10<?php */?>
    <?php query_posts(‘showposts=5’); ?>
    <?php $posts = get_posts(‘numberposts=4&offset=4’); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count2 = 0; if ($count2 == “4”) { break; } else { ?>
    <div class=”thumbnail”>
    <a href=”<?php the_permalink(); ?>” title=”<?php the_title_attribute(); ?>”>
    <img src=”<?php bloginfo(‘template_directory’); ?>/timthumb.php?src=<?php getImage(‘1’); ?>&w=270&h=140&zc=1″>
    </a>
    </div>
    <?php #the_content(); ?>

    <?php $count2++; } ?>
    <?php endforeach; ?>
    </div>
    <div id=”column_03″>
    <?php /*?>// THIRD LOOP: display posts 11 thru 15<?php */?>
    <?php query_posts(‘showposts=4’); ?>
    <?php $posts = get_posts(‘numberposts=4&offset=8’); foreach ($posts as $post) : start_wp(); ?>
    <?php static $count3 = 0; if ($count3 == “4”) { break; } else { ?>
    <div class=”thumbnail”>
    <a href=”<?php the_permalink(); ?>” title=”<?php the_title_attribute(); ?>”>
    <img src=”<?php bloginfo(‘template_directory’); ?>/timthumb.php?src=<?php getImage(‘1’); ?>&w=270&h=140&zc=1″>
    </a>
    </div>
    <?php #the_content(); ?>

    <?php $count3++; } ?>
    <?php endforeach; ?>
    </div>
    </div>
    </div>

    here is the function code:

    <?php
    // retreives image from the post
    function getImage($num) {
    global $more;
    $more = 1;
    $content = get_the_content();
    $count = substr_count($content, ‘<img’);
    $start = 0;
    for($i=1;$i<=$count;$i++) {
    $imgBeg = strpos($content, ‘<img’, $start);
    $post = substr($content, $imgBeg);
    $imgEnd = strpos($post, ‘>’);
    $postOutput = substr($post, 0, $imgEnd+1);
    $image[$i] = $postOutput;
    $start=$imgEnd+1;

    $cleanF = strpos($image[$num],’src=”‘)+5;
    $cleanB = strpos($image[$num],'”‘,$cleanF)-$cleanF;
    $imgThumb = substr($image[$num],$cleanF,$cleanB);

    }
    if(stristr($image[$num],'<img’)) { echo $imgThumb; }
    $more = 0;
    }
    //retreive image ends
    ?>`

    Please I need help! THANK YOU VERY MUCH IN ADVANCE !!!!!!!

  • The topic ‘timthumb.php with lightbox 2 problem! NEED HELP!!!’ is closed to new replies.