I am using this code to create an image
If you want a div around your image you have to do that in the html, you can't do that in the image generation code
<div>
<img src="http://localhost/php/test92.php">
</div>
If you are getting errors regarding the image, try browsing the image url http://localhost/php/test92.php and see what it looks like.
Does it show an image like you are expecting?
Basically, to create dynamic image in HTML, you will need 2 PHP files:
Let's take a look how to do it:
You create image.php
that accept parameter, like: image ID or file name. For security reason, you HAVE to filter whatever parameter it get.
Why you have to do this? because, to generate image, you can't mix it with another HTML output. Let alone a single
space
orreturn
as this will render the image broken.
You do the HTML thing on another PHP, say test92.php
. To the HTML logic here, like:
<img src="image.php?imageID=12" alt="" />