Here's a basic PHP one I pulled out of my ass:
pictures.txt
Code:
image1.jpg|http://somelink.com/
imaagagads3.jpg|http://notherlinkg.com/
akadsfd.jpg|http://asdfasdf/
random_image.php
Code:
$file = file("pictures.txt");
list($img,$link) = each(explode("|",$filerand (0, (count($file)-1)));
echo "<a href=\"".$link."\"><img src=\"".$img."\"></a>";
* note, code not checked or validated to work