Let\'s describe the task first:
I\'d like to create a web-page with several rows of a text and a small (let\'s say 100 by 20 pixels) graphic for each one. Each graphic g
You can serve an image from PHP rather than from a file - I mean you can have PHP dynamically create an image and serve it rather than having to have a file in your webserver's filesystem and having to refer to it by name in the src field of an tag in your HTML.
So, instead of
you can use
which causes the PHP script at /php/thumb.php
to be called when the page is rendered. In that script, you can dynamically create the image (using extra parameters if you wish) like this:
I have omitted some code after the first 3 lines so you just see the technique rather than all the gory details of my code. The actual lines you are interested in are:
header(...image/png);
which tells the browser what type of stuff is coming - i.e. an image, and
imagepng();
which actually sends the stream of PNG data to the browser.
The code above produces this in the browser: