Theming user pictures
You need to (really should) use a render array.  You can use theme_image_style:

// first, make a render array for your image, as a thumbnail...
$image_ra = array(
    '#theme' =&gt; 'image_style',
    '#path' =&gt; _drupal_wall_user_profile_picture($friend_id),
    '#alt' =&gt; 'Some alt value',
    '#title' =&gt; 'Some image title value',
    '#style' =&gt; 'thumbnail'
);


// now make your link render array...
$ra = array(
    '#theme' =&gt; 'link',
    '#text' =&gt; drupal_render($image_ra),
    '#path' =&gt; $base_url . '/user/' . $friend_id,
    '#options' =&gt; array(
        'html' =&gt; TRUE,      // this says the #text value is HTML markup
    )
);

// now you can render your image link into markup...
$image_markup = drupal_render($ra);


I took the long way to show you that you need to handle the image first, and then render it as #text in the link.  I also did this to make the case that you really, really, really, really should use render arrays and stay away from writing the HTML.  Let Drupal do that work.  Just build a render array, pass it to drupal_render, and be done with it.