The src attribute in the <img> tag specifies the url where to download the image from.
If you write a php script that outputs an image you can treat that php script as if it was an image.
<img src='picture.jpg'> vs.
<img src='picture.php'>
so if you write <img src='picture.php'> in an html page, the browser will download the output of script.php and expect it to be an image that it can display. If you add ?img=abc123 to the end of the source, the php script picture.php will be given a variable $img with the value 'abc123'.
So when you write the php script that outputs an image you can use data from the url to generate the image.
<img src='picture.php?text=Hello%20World&w=100&h=20'>
in picture.php
<?php
header ("Content-type: image/jpg");
$myPic = ImageCreateTrueColor ($w, $h);
$red = ImageColorAllocate ($myPic, 255, 0, 0);
imagestring ($myPic, 5, 2, 3, $text, $red);
ImageJPEG($myPic);
?>