Re: postgres-embedded images via php. two issues...
| From: | Tom Rogers | Date: | Wed, 03 Nov 2004 00:20:52 +0000 |
| Subject: | Re: postgres-embedded images via php. two issues... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200981@lists.php.net to get a copy of this message | ||
Hi,
Wednesday, November 3, 2004, 8:45:17 AM, you wrote:
PG> i am storing images in a postgres database and i have set up a little
PG> php file to retrieve them in such a way that i can do:
PG> echo "<img src='gif.php?name=$picname'>";
PG> ...from another php file.
PG> it's working great, BUT i've noticed two things that bother me:
PG> [1] if someone wants to download an image, they can, but it will be
PG> downloaded as "gif.php" instead of "whatever.gif". even though
PG> renaming the file solves the problem, users will be confused by this.
It does not matter what the extension is, it is the header that has more sway
PG> [2] (and i think this may be related to the first problem) is that in
PG> at least one of my browsers (camino/osx) the images are ALWAYS pulled
PG> directly from the server. they are never cached by the browser. i
PG> suppose all browsers may be behaving this way, but in camino, it is
PG> blatantly and visually obvious as you watch the gif being slowly
PG> downloaded/displayed over a slow connection.
The browser wont cache url's that have the ? in them so change your info passing
scheme to echo "<img src='gif.php/name=$picname'>";
then process the query string to extract the info
You could even add a dummy value at the end like
src='gif.php/name=$picname/type.gif to make it look like a gif'
PG> anyone know what to do for either of these? concerning [2], i'm
PG> thinking maybe i can implant the local browser cache _manually_ instead
PG> of depending on the browser to do it for me? if so, how would i go
PG> about doing that?
PG> thanks.
PG> - philip
--
regards,
Tom