变量in然后检查图像是否存在

I have a variable:

$map = $row['map'];

I need to check if the link contains "/csgo/maps/$bgimg".

I tried this:

 $bgimg = 'map/csgo/' . $map. '.jpg';

 if(!file_exists($bgimg)){ $bgimg = "other_link"; }

However, the script returns "other_link" every time.

EDIT:

  $topmaps = mysql_query ("SELECT * FROM `lgsl` where status='1' and map!='-' group by map order by count(map) desc limit 0,5");

    if ( $topmaps == true ){
    while ($row = mysql_fetch_array($topmaps))
    {
    $maps = mysql_query("SELECT * FROM `lgsl` where status='1' and `map`='$row[map]'");
    $maps_num = mysql_num_rows($maps);
    if ($maps_num == 1) {$nums = "server";} else {$nums = "servers";}

     $harta = $row['map'];

// CHECK IF BACKGROUND IMAGE EXISTS, IF NOT USE DEFAULT

    $bgimg = 'http://image.www.gametracker.com/images/maps/160x120/csgo/' . $harta . '.jpg';

     if (!file_exists($bgimg)) {
     $bgimg = "http://image.www.gametracker.com/images/maps/160x120/nomap.jpg";
     }

This is my entire script... I have a var_dump($bgimg) at the end, which produces:

 string(62) "http://image.www.gametracker.com/images/maps/160x120/nomap.jpg" - x5 times