From: | Stephen van Egmond <svanegmond(at)bang(dot)dhs(dot)org> |
---|---|
To: | chriswood(at)wvda(dot)com |
Cc: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: Question re large objects |
Date: | 2000-11-28 18:29:23 |
Message-ID: | 20001128132923.B30495@bang.dhs.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
chriswood(at)wvda(dot)com (chriswood(at)wvda(dot)com) wrote:
> I've considered the alternatives (store files in a directory or in the
> db), and I think storing the image files in the database is the way to
> go. Unless anybody can think of why I should just upload the files
> to a directory on the server instead of storing them as BLOBs.
Because you will lose the images when you do a restore from backup.
And you will have to restore from backup eventually, count on it.
On the other hand, if your service will ever grow to more than one
computer doing HTTP service (i.e. load balancing), you will have to
have the items in the database or resort to unsightly things like NFS.
If you expect your site to get big or be busy, you will have to come up
with a way (preferably an abstraction on top of pg_lo* functions) that
will preserve the BLOBs in the database so that when you do a reload,
you can pump in the BLOBs as well and connect their *new* OIDs with the
appropriate table. Because the OIDs will change when you reload.
You do have a backup plan, right?
> plunks itself into my test page as text/plain. How do I get a mime
> type header associated with this data so my browser will recognize
> it as a gif or jpeg?
Store the content type in the database along with the file data. When
you pull it out, use:
header("Content-type: $mime");
,,,
(. .)
+--ooO-(_)-Ooo------------ --- -- - - - -
| Stephen van Egmond http://bang.dhs.org/
From | Date | Subject | |
---|---|---|---|
Next Message | chriswood | 2000-11-28 18:35:02 | Re: Question re large objects |
Previous Message | Justin Long | 2000-11-28 17:48:41 | RE: Question re large objects |