PHP Code:
<?php
if($_SERVER['QUERY_STRING']){
$code = $_SERVER['QUERY_STRING'];
} else {
$code = "whatever";
}
echo($code);
?>
Put this script where you want that code to be displayed on a gallery (must be php page).
Link to a gallery like this:
http://www.site.com/gallery.php?code
In the else part, replace it with what you want it to fill in if no code is present.