// image grabber function
function pbt_resize($w,$h,$class='alignleft',$showlink=true) {
global $more, $post;
$title = the_title_attribute('echo=0');
if($showlink) {
$link = "<a href='".get_permalink()."' title='$title'>";
$linkend = "</a>";
} else {
$link ="";
$linkend="";
}
$more = 1;
$content = get_the_content();
$pattern = '/<img[^>]+src[\\s=\'"]';
$pattern .= '+([^"\'>\\s]+)/is';
$more = 0;
if(preg_match($pattern,$content,$match)) {
$theImage = "$link<img src=\"$match[1]\" class=\"$class\" alt=\"$title\" width=\"$w\" height=\"$h\" />$linkend\n\n";
return $theImage;
}
}