List Info

Thread: note 61883 added to function.header




note 61883 added to function.header
user name
2006-02-14 16:07:47
I store a lot of images in databases rather than files, and
PHP was causing my user's web browsers to not cache these
images, which means that every time they went to my web
site, they were reloading the same images over and over
again.  To fix this, I have added the following headers to
my download.php script:

Header("Expires: " . date("D, j M Y
H:i:s", time() + (86400 * 30)) . " UTC");
Header("Cache-Control: Public");
Header("Pragma: Public");

This causes the user's web browsers to cache the image data
(in this case for 30 days, but you can make that whatever
you want).  This sped up my web sites and cut down on hits
to my server considerably.  So, if you are delivering images
through PHP, you should consider adding these headers to
your script too.
----
Server IP: 64.71.164.2
Probable Submitter: 69.33.133.2
----
Manual Page -- http
://www.php.net/manual/en/function.header.php
Edit        -- http://master.php.net/manage/user-notes.php?action=
edit+61883
Delete: added to the manual -- htt
p://master.php.net/manage/user-notes.php?action=delete+61883
&report=yes&reason=added+to+the+manual
Delete: bad code            -- http://master.
php.net/manage/user-notes.php?action=delete+61883&report
=yes&reason=bad+code
Delete: spam                -- http://master.php.
net/manage/user-notes.php?action=delete+61883&report=yes
&reason=spam
Delete: useless             -- http://master.p
hp.net/manage/user-notes.php?action=delete+61883&report=
yes&reason=useless
Delete: non-english         -- http://mast
er.php.net/manage/user-notes.php?action=delete+61883&rep
ort=yes&reason=non-english
Delete: already in docs     -- http://
master.php.net/manage/user-notes.php?action=delete+61883&
;report=yes&reason=already+in+docs
Delete: other reasons       -- http://master.php.net/manage/user-
notes.php?action=delete+61883&report=yes
Reject      -- http://master.php.net/manage/user-
notes.php?action=reject+61883&report=yes
Search      -- http://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )