I am assembling a portfolio website with a quantity of images, most of which I'd rather not be viewable by everyone. I suppose I'll email someone a person title and password, that they are able to "log-in" to see my work.
I have seen various methods to the "hide-an-image" problem online such as the following, which uses php's readfile. I have also seen another that utilizes .htaccess.
I am not in love with the readfile solution, because it appears slow to load the pictures, and Let me have the ability to use Cabel Sasser's FancyZoom, which needs unfettered use of the look, (his library wants a hyperlink fully sized image), to ensure that rules out .htaccess.
In conclusion what I am attempting to do:
1) Give a site where I give customers a chance to authenticate themselves as someone I would like searching inside my images. 2) Restrict random web customers from having the ability see individuals images. 3) Use FancyZoom to inflate pictures.
Incidentally, I am a Java Developer, not really a webmaster, so I am most likely not taking into consideration the problem properly.
Rather than supplying a hyperlink for an image. Give a connect to a cgi script that will instantly supply the proper header and content from the image.
For instance: image.php?sample.digital
After that you can make certain they're already authenticated (e.g. pass a session id) included in the link.
This is area of the header, and your image data can follow.
Edit: Whether it needs to be fast, you are able to write this in C/C++ rather than php.
Using .htaccess ought to be the most secure/easiest method, as it is built-in functionality from the webserver itself.
I don't determine if it meets your needs, however i solved an identical poblem(giving pictures to some restricted group) by utilizing TinyWebGallery, the industry small gallery application without database.
You are able to allow use of different sites via password and you will upload pictures into the filesystem, as TinyWebGallery will look for new dirs/photos quickly. It'll generate pictures and provides customers possible ways to rate / comment pictures (You are able to disable this).
This isn't the littlest tool, however thik it's far simpler to create than using apache directives also it looks better as naked images.