For those playing at home one thing i noticed that helped speed things
up again was the following:
My app has a photo gallery system in it, i was getting annoyed at
clicking pages, watching the page load with cached images, then one by
one reload the thumbnails when nothings changed. I also noticed the
following header in the requests from my browser:
If-Modified-Since: Mon, 10 Sep 2007 06:53:24 GMT
Assuming it did what i thought it did, i did a quick little bit of
research & borrowed some code & added it to my site as follows:
$if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ?
stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false;
if ($if_modified_since && $if_modified_since == gmdate('D, d M Y
H:i:s',strtotime($photo['Photo']['modified'])) . ' GMT')
{
header('HTTP/1.0 304 Not Modified');
}
else
{
readfile($imageDir.$photo['Photo']['id']);
}
This stopped the browser reloading it when its already cached properly
on a refresh, it only reloads now if the modified field changes OR u
do a ctrl+f5 refresh in firefox. Another thing that reduced the load &
sped things up.
Just thought id post that for anyone interested
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---