WordPress.org

Ready to get started?Download WordPress

Forums

upPrev
[resolved] output error thumbnails (2 posts)

  1. RJDallacort
    Member
    Posted 2 years ago #

    code

    } else {
                    ob_start();
                    do_action( 'iworks_upprev_image' );
                    $image = ob_get_flush();
                }

    and

    function show_upprev_image ()
    {
    	$a_class = "upprev_thumbnail";
    	$img_class = "iworks_upprev_thumb";
    
    	if ($postid<1)
    		$postid = get_the_ID();
    	$thumb = get_post_meta($postid, "thumb", TRUE); // Declare the custom field for the image
    	if ($thumb != null or $thumb != '') {
    		$src_img = get_image_path($thumb);
    	}
    	elseif ($images = get_children(array(
    		'post_parent' => $postid,
    		'post_type' => 'attachment',
    		'numberposts' => '1',
    		'post_mime_type' => 'image', )))
    		foreach($images as $image) {
    			$thumbnail=wp_get_attachment_image_src($image->ID, $size);
    			$src_img = get_image_path($thumbnail[0]);
    	 	}
    		else {
    		$theme_name = strtolower(get_current_theme());
            $src_img = get_image_path('wp-content/themes/'.$theme_name.'/images/image-pending.gif');
    	}
    	$src=get_bloginfo('template_directory').'/includes/timthumb.php?src='.$src_img.'&h=60&w=60&zc=1';
    	$alt = get_the_title();
    	$rel = get_the_title();
    	$href = get_permalink();
    	$img = '<a href="'.$href.'" rel="'.$rel.'" class="'.$a_class.'"><img class="'.$img_class.'" src="'.$src.'" alt="'.$alt.'" /></a>';
    	print $img;
    }
    add_action( 'iworks_upprev_image', 'show_upprev_image' );

    duplicates the output image.

    Fixed at

    } else {
                    ob_start();
                    do_action( 'iworks_upprev_image' );
                    $image = ob_get_clean();
                }

    did I it correctly?
    PS.
    Server info
    WordPress: 3.3.1
    PHP: 5.3.6-13ubuntu3.6
    MySQL: 5.1.61-0ubuntu0.11.10.1
    WebServer: Apache/2.2.20

    http://wordpress.org/extend/plugins/upprev/

  2. Marcin Pietrzak
    Member
    Plugin Author

    Posted 2 years ago #

    I think, is something wrong in Your code, because this example works perfectly:

    <?php
    function show_upprev_image()
    {
        $a = '<img src="';
        $a .= 'http://0.gravatar.com/avatar/';
        $a .= 'c2ad634813e4462f0532a9cf0c903e2c';
        $a .= '?s=60';
        $a .= '" alt="" />';
        echo $a;
    }
    add_action( 'iworks_upprev_image', 'show_upprev_image' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags