you want to use php my friend...
(or ASP or some other kind of server side langauge)
Here's a nice simple example to display a name and a photo depending on what info is passed via the url:
print('Picture of '.$name.'<br>');
print('<img src="'.$pic.'" alt="'.$name.'">');
Then the page can display different images by being called like so: