There is nothing wrong with calling e.g. a php-script from an <img src="file.php"> tag. E.g.:
-- test.php --
<?
header("Content-type: image/gif");
$fp = fopen("file.gif", "r");
$fileData = fread($fp, filesize("file.gif"));
fclose($fp);
echo ($fileData);
?>
-- /test.php --
You can also parse variables to such a php script with GET method;
<img src="test.php?number=4302&style=digital&color=green">
And then generate the appropriate image using ImageGIF() or similar.