umm are the images loaded in a loop? if so:
i think you can use a simple str_replace($haystack, $needle); to replace the image loaded with:
str_replace("$image_file_name","<span blah blah>$image_file_name</span>",$dbrow['image_file_name']);
if that is not remotly close to what you need, could you try to explain it a bit more for me please 🙂 i still got a bit of sawdust left in my head