SPUG:CGI header question

Peter Darley pdarley at kinesis-cem.com
Thu Jun 19 12:01:40 CDT 2003


Brian,
	The problem with the expires thing is that I need to know beforehand when
the file is going to change, and I can't know this.  The system is to
organize pictures coming out of a digital camera, and one of the functions
is to spin the picture 90 degrees so it's oriented correctly if the camera
was held on it's side.  Since this could be done at any time I can't predict
when the image will change. :(
Thanks,
Peter Darley

-----Original Message-----
From: spug-list-admin at mail.pm.org [mailto:spug-list-admin at mail.pm.org]On
Behalf Of Brian Hatch
Sent: Thursday, June 19, 2003 9:44 AM
To: Aaron Salo
Cc: SPUG
Subject: Re: SPUG:CGI header question




> <rant>
> files belong in the *file system*
> data belongs in the *database*
> </rant>

I agree with much of the rest of this comment.  Apache is great at
serving files, so why not let it serve the images directly.

> <img src='Photo.pl?PhotoID=14232'>

this should be " instead of ' by the way.


You can have perl include an 'expires' header for your CGI output, and
then browsers will cache it.

	print header( -expires => +1d );

sets the result to be valid for 1 day, so browsers shouldn't re-check
the file until tomorrow.  Do a 'perldoc CGI' and look for the -expires
option.  You can specify dates/times in many different formats.




--
Brian Hatch                  "There are 10 of us, all of family
   Systems and                Zathras, each one named Zathras.
   Security Engineer          Slight differences in how you
http://www.ifokr.org/bri/     pronounce.  You are seeing now?"

Every message PGP signed




More information about the spug-list mailing list