Re: Storing jpgs

Поиск
Список
Период
Сортировка
От scott.marlowe
Тема Re: Storing jpgs
Дата
Msg-id Pine.LNX.4.33.0404051057390.13872-100000@css120.ihs.com
обсуждение исходный текст
Ответ на Storing jpgs  ("C G" <csgcsg39@hotmail.com>)
Список pgsql-general
On Mon, 5 Apr 2004, C G wrote:

> Dear All,
>
> What's the best way to store jpgs in postgresql to use in a web page?
>
> I tried to use large objects, but how would you extract them from a table to
> be viewed in a web-page without having to write them to a scratch file
> somewhere first?

There are several ways to skin this cat, and your choice depends largely
on what type of system you'll be deploying.

Will you have more than one front end server?  If so, will they be able to
share a network file system mount for the files?  Then the preferred
method for many people is to store the jpg in the file system with a path
in the database.  If you can't mount the same point from multiple servers
(or don't want to) then you'll need to store them in the database.

However, maybe you want to be able to update multiple jpegs at the same
time in a transaction?  then storing them in either a bytea field or
base64 encoded in a text field will work well.

Storing them as base64 or as a path with a file system is likely more
portable than using large objects.  Also, you have to dump large
objects seperately, so your backup process may be more complicated than
you want.

As for displaying them whether you store them as bytea, base64 encoded
text, or large objects, most languages will allow you to build and deliver
an image without having to write it to some temporary place.

Here's a simple example from PHPBuilder on doing it with the file path in
the database, and using a directory of files that may lie outside the
documentroot of apache:

http://www.phpbuilder.com/board/showthread.php?s=&postid=10497815#post10497815


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

Предыдущее
От: "Rod K"
Дата:
Сообщение: Re: Storing jpgs
Следующее
От: Lamar Owen
Дата:
Сообщение: Re: RPM init-script: Why the locale setting?