Hi,
You could have an array that loops through the extensions ...
// given $path_to_image (excluding the extension)
$exts = array('png', 'jpeg', 'jpg', 'gif');
$file = '';
foreach($exts as $ext){
if(file_exists($path_to_image.'.'.$ext)){
$file = $path_to_image.'.'.$ext;
break;
}
}
if($file){
// image
} else {
// text
}
Look up the function file_exists() in the manual to get the technicalities of paths.
P.