使用图像媒体库标题在循环中显示Wordpress媒体

I am trying to output flag icons based on selections from a custom multiselect dropdown where users can select (up to 4) languages they can speak. I have uploaded icons to my Media Library, and titled them "english.png", "german.png" and so forth. Is it possible to display a media file based on the title? Ideally, I would be able to do something as below, but I could not find any documentation on how to do so. Any input (or alternative recommendations) welcomed! Thanks :)

//example dropdown selection values: "german", "english"

if ( get_job_field( 'language' ) ) :

   $languages = get_job_field( 'language' );
   foreach ($languages as $language) {
      echo '<image src="'.$language.'.png">';             
  }
 endif;

//example output: <img src="german.png"><img src="english.png">

I have found an (albeit imperfect) solution:

foreach ($languages as $language) {

   echo "<img src='https://www.wgeil.de/wpcontent/uploads/2017/02/".$language.".png'>";

 }

try this

$lans = array();
if ( get_job_field( 'language' ) ) :
   $languages = get_job_field( 'language' );
   foreach ($languages as $language) {
       $lans[] = $language . '.png';                  
  }
endif;

$args = array(
    'post_type'      => 'attachment',
    'post_mime_type' => 'image',
    'post_status'    => 'inherit',
    'posts_per_page' => - 1,
);
$query = new WP_Query( $args );
foreach ( $query->posts as $img ) {
    $filename = basename ( get_attached_file( $img->id ) );
    if( in_array( $filename, $lans )) {
        echo '<image src="'. wp_get_attachment_url( $img->ID ); .'">';
    }
}

may be it will help you