Php Image

I’m not sure exactly how to go about this, but I want to have something like this:


<img src="img.php?img=path/to/my/image.jpeg">

Where img.php will will take the path and output it. It will do basically the same thing the html <img> tag will do, but this way I can get the image from an .htpasswd protected directory.

If anyone knows how to do this, or a better way to display an image within a protected directory, that would be great.

Thanks.