From: | PFC <lists(at)peufeu(dot)com> |
---|---|
To: | "Rick Schumeyer" <rschumeyer(at)ieee(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: yet another image: db or filesystem ? question |
Date: | 2007-07-17 17:42:37 |
Message-ID: | op.tvmd5bt3cigqcu@apollo13 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> a) if the images are in the filesystem (and also under the web root), no
> problem. Just use <img src="filename.jpg" />
>
> b) if the images are in the database...
You use <img="images/filename.jpg" /> and setup URL rewriting in your
webserver so that a HTTP request on "images/filename.jpg" becomes
"serve_image?fname=filename.jpg" with serve_image being a php, jsp,
whatever script.
This way when the performance starts to suck too much you can simply
serve images off the filesystem very easily, just remove the URL rewriting.
Please use your primary key (an integer) as filename, don't let the users
name files on your filesystem !!
If you are trying to control user access rights to files, it is much
faster to use an authenticator plugin, or lighttpd's mod_sec_download.
In both cases the web application is only invoked to decide if the user
can access the image or not ; it does not actually handle the (potentially
large) file. It is the webserver that does it, and webservers are
optimized for this purpose.
If it's for an intranet where you don't expect lots of traffic, though,
the PHP echoing a bytea it got from postgres works well...
> do I need to create a temporary file first in order to use the <img>
> tag? Or is there some other HTML way of doing this?
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew Terenzio | 2007-07-17 19:57:50 | Re: PHP pg_connect |
Previous Message | Zlatko Matić | 2007-07-17 17:16:11 | Re: ERROR: a column definition list is required for functions returning "record" |