I have a group of dental photos that are stored using the patient's name that I would like to display on a webpage - minus the patient's info of course. It will all be in a password protected area, but one thing I realized is that if anyone inspected the element, it would have the path of the photo, which contains their name.
I used the code from this post: https://stackoverflow.com/a/35724642/3025534 which gives me back:
/pics/O/Patient Name1
|_DSC_0338.JPG
|_DSC_0339.JPG
|_DSC_0340.JPG
/pics/O/Patient Name2
|_DSC_3947.JPG
/pics/O/Patient Name3
|_DSC_2541.JPG
|_DSC_2542.JPG
I now have all the filename / path data in the database from that.
My brother was hoping I could setup a mini photo gallery that in "Admin" mode would show the patient names, but then when he wanted to show it to someone, it hides all that info.
I stumbled across this code that would work, but only for one file since it sets the header:
<?php
$file = 'your_images.jpg';
header('Content-Type: image/jpeg');
header('Content-Length: ' . filesize($file));
echo file_get_contents($file);
?>
I could then reference that file by doing something like <img src="image.php?file=/pics/O/Patient Name1/DSC_0338.JPG">
but then I have just defeated the purpose of obfuscating it.
How would I loop though an array of files to display more than one at a time, in a gallery type format (not just lumped at the beginning or end of the page), while still hiding the source?
I should mention that there will be spaces in the filenames / directory names. It isn't my organizational structure, so I can't change it at the source- and it is part of an incremental backup, so I can't change it on the server.