Title: [Plugin: upPrev] output error thumbnails
Last modified: August 20, 2016

---

# [Plugin: upPrev] output error thumbnails

 *  Resolved [RJDallacort](https://wordpress.org/support/users/rjdallacort/)
 * (@rjdallacort)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-upprev-output-error-thumbnails/)
 * 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/](http://wordpress.org/extend/plugins/upprev/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Marcin Pietrzak](https://wordpress.org/support/users/iworks/)
 * (@iworks)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-upprev-output-error-thumbnails/#post-2671838)
 * 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' );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: upPrev] output error thumbnails’ is closed to new replies.

 * ![](https://ps.w.org/upprev/assets/icon.svg?rev=1268272)
 * [upPrev](https://wordpress.org/plugins/upprev/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/upprev/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/upprev/)
 * [Active Topics](https://wordpress.org/support/plugin/upprev/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/upprev/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/upprev/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Marcin Pietrzak](https://wordpress.org/support/users/iworks/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-upprev-output-error-thumbnails/#post-2671838)
 * Status: resolved