allow_url_fopen
is activated in your PHP config
$filename = "http://".$_SERVER['SERVER_NAME']."
/media/img/".$row['CatNaam'].".jpg";
echo" <img src=\"".$filename."\" alt=\"".$row['CatNaam']."\">";
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}