Images in member header

How can I display images of the Bp media in member header?

 

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/4848/2012/08/images.jpg

There isn’t any existing function for something like that, but here’s what you can use in your theme:

  
function show_last_n_images($n=5){  
    if(bp_displayed_user_id()){  
    global $bp;  
    $args = array(  
                'post_type' => 'bp_media',  
                'author' => $bp->displayed_user->id,  
                'meta_key' => 'bp_media_type',  
                'meta_value' => 'image',  
                'meta_compare' => 'LIKE',  
                'posts_per_page' => $n  
            );  
    $q=new WP_Query($args);  

    if ($q && $q->have_posts()):  
        echo '
    '; while ($q->have_posts()) : $q->the_post(); bp_media_the_content(); endwhile; echo '
'; endif; } }

You can then call this function anywhere in your theme and you’ll get the last n images of the displayed user

Thank you very much you helped me

Code worked great. But when I updated the plugin code does not work.