Pull first image from each node to use in view I want to take the first image from the images each node has in its body, to use it as a thumbnail when displaying nodes in a view. How can I do this?
I've used this regex in my views templates for this task -- it works by grabbing the src from the first image tag in the body content (assumes using fields view style):

$output = preg_match_all('/&lt;img.+src=[\'"]([^\'"]+)[\'"].*&gt;/i', $fields["body"]-&gt;content, $matches);
$first_img = $matches[1][0];

if (!empty($first_img)) {
     print "&lt;img src='$first_img'&gt;";
}


You can also pass the source to your imagecache theme function, as Jim and jimajamma suggest, to scale the image.