This method of displaying the image essentially turns the PHP request into an image. Therefore, each request can handle no more than a single image. If you try to print more than a single image, you corrupt the first one, or just pad the end of it with the additional images without actually getting them displayed.
If you want to display more than one image per page using this method, you need to request the PHP script multiple times, one for each image. For example, if you were to put my last script into a file called "get_image.php", you could do this to display three images in a HTML document.
- <img src="get_image.php?image=first.jpg" alt="First image"><br>
-
<img src="get_image.php?image=second.jpg" alt="Second image"><br>
-
<img src="get_image.php?image=third.jpg" alt="Third image">
You could use a similar page, created by a second PHP script, to display all the images from your database.