Re: yet another image: db or filesystem ? question

Поиск
Список
Период
Сортировка
От PFC
Тема Re: yet another image: db or filesystem ? question
Дата
Msg-id op.tvmd5bt3cigqcu@apollo13
обсуждение исходный текст
Ответ на yet another image: db or filesystem ? question  (Rick Schumeyer <rschumeyer@ieee.org>)
Список 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Zlatko Matić
Дата:
Сообщение: Re: ERROR: a column definition list is required for functions returning "record"
Следующее
От: Matthew Terenzio
Дата:
Сообщение: Re: PHP pg_connect