I'm totally new to how to cache images.
I output all images in a gallery with php, and want the images already shown, to be cached by the browser, so the php-script don't have to output the same image again. All I want is the images to show up faster.
when calling an image I do like this:
<img src="showImage.php?id=601">
and the showImage.php
-file does:
$resultat = mysql_query("
SELECT filename, id
FROM Media
WHERE id = '".$_GET['id']."'
");
$data = mysql_fetch_assoc($resultat);
...
//Only if the user are logged in
if(isset($_SESSION['user'])){
header("Content-Type: image/jpeg");
//$data['filename'] can be = dsSGKLMsgKkD3325J.jpg
echo(file_get_contents("images/".$data['filename'].""));
}