Hi, I have exactly the same problem with Foo Gallery but my function.php don’t have the code line
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99 );
add_filter( 'the_content', 'shortcode_unautop', 100 );
and my theme “Ribosome Free” has not files called shortcode.php or filters.php or something similar.
The problem (the images show up with small boxes below) occurs only when i use the template “Single Thumbnail Gallery” of the Foo Gallery plugin.