I don't want to show the real URL of images. So I am using uniqueid()
to replace the URL of dynamic images and store the real URL against the uniqueid()
in a session. So I will get a load of uniqueids => real-image-path.jpg
in the session array. Then using the following code to echo out image:
<img src="getImage2.php?h=<?php echo $uniqueID; ?>" title="" >
That all seems to work. In getImage2.php
, I'm wondering how I can use the variables stored in the session to echo out the images. I have got:
session_start();
header("Content-Type: image/jpeg");
while($_SESSION[$uniqueID]){
echo readfile($_SESSION[$uniqueID]);
}
But this looks pretty hopeless and obviously isn't working. What is the best way to echo the images in getImage2.php
?
Sample of session array looks like this:
Array ( [start] => 1435057843
[start_date] => 23/06/15
[start_time] => 12:10:43
[b312a3f205176aa006c8712b3aedb2a4] => images/1370322222.jpg
[5311d8a77e3889723a61b3768faaa4df] => images/1357323650.jpg
[fa14a6a315bf7ddbeb7390af23467f5e] => images/1415737586.jpg
[dd624079e982d78e538f873b7719f179] => images/1369865823.jpg
[5c4011114f6abbb9ecaf2ffbe4d3936f] => images/1369885151.jpg
[d26e3a017ce4851a19511fc0dfedc595] => images/1370317410.jpg
.............