pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Data type for storing images?
11+ messages / 7 participants
[nested] [flat]
* Re: Data type for storing images?
@ 2001-03-11 18:40 ryan@paymentalliance.net
parent: drevil@sidereal.kz
2 siblings, 1 reply; 11+ messages in thread
From: ryan@paymentalliance.net @ 2001-03-11 18:40 UTC (permalink / raw)
To: pgsql-general@postgresql.org
I am not sure what your exact purpose is, but in doing a lot of web
work with pgsql, I usually just store the full path to the image in a
varchar field and fetch that right into the IMG SRC attribute when I
need to display the image.
I also have modified a simple web based image uploading script so upon
uploading an image it detects the images width and height and inserts
that into the DB as well. The script is written in PHP, let me know
if it would be helpful to send it to you.
Good Luck
-Ryan Mahoney
On Sun, 11 Mar 2001 22:52:53 +0000 (UTC), <drevil@sidereal.kz> wrote:
>
>I would like to store some images in my Postgres database. These will
>all be thumbnails, limited to 4k or 5k. I know that PG has an 8k row
>limit, but this should be fine, because there's not much else in the
>row. Which data type could I use to store them, and is there a
>performance cost for having rows that are this big? The system will
>be using PG7.1, btw.
>
>Thanks
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
^ permalink raw reply [nested|flat] 11+ messages in thread
* Data type for storing images?
@ 2001-03-11 22:38 drevil@sidereal.kz
0 siblings, 3 replies; 11+ messages in thread
From: drevil@sidereal.kz @ 2001-03-11 22:38 UTC (permalink / raw)
To: pgsql-general@postgresql.org
I would like to store some images in my Postgres database. These will
all be thumbnails, limited to 4k or 5k. I know that PG has an 8k row
limit, but this should be fine, because there's not much else in the
row. Which data type could I use to store them, and is there a
performance cost for having rows that are this big? The system will
be using PG7.1, btw.
Thanks
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Data type for storing images?
@ 2001-03-12 01:48 Tom Lane <tgl@sss.pgh.pa.us>
parent: drevil@sidereal.kz
2 siblings, 2 replies; 11+ messages in thread
From: Tom Lane @ 2001-03-12 01:48 UTC (permalink / raw)
To: drevil@sidereal.kz; +Cc: pgsql-general@postgresql.org
<drevil@sidereal.kz> writes:
> I would like to store some images in my Postgres database. These will
> all be thumbnails, limited to 4k or 5k. I know that PG has an 8k row
> limit, but this should be fine, because there's not much else in the
> row. Which data type could I use to store them, and is there a
> performance cost for having rows that are this big? The system will
> be using PG7.1, btw.
bytea is probably your best bet. The 8k limit is toast in 7.1, btw.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Data type for storing images?
@ 2001-03-12 02:12 David Wall <d.wall@computer.org>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 11+ messages in thread
From: David Wall @ 2001-03-12 02:12 UTC (permalink / raw)
To: drevil@sidereal.kz; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@postgresql.org
> bytea is probably your best bet. The 8k limit is toast in 7.1, btw.
If you're using JDBC, you may not be able to get bytea types to work. I was
able to get the SQL type OID to work with JDBC's get/setBytes() methods.
You may also want to use 7.1 since I believe it's large object support is
improved.
David
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Data type for storing images?
@ 2001-03-12 10:19 Frank Joerdens <frank@joerdens.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 11+ messages in thread
From: Frank Joerdens @ 2001-03-12 10:19 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@postgresql.org
On Sun, Mar 11, 2001 at 08:48:21PM -0500, Tom Lane wrote:
[ . . . ]
> bytea is probably your best bet. The 8k limit is toast in 7.1, btw.
Is that whay you named it TOAST, in order to be able to say that? :)))
Regards, Frank
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Data type for storing images?
@ 2001-03-13 07:31 Lincoln Yeoh <lyeoh@pop.jaring.my>
parent: drevil@sidereal.kz
2 siblings, 1 reply; 11+ messages in thread
From: Lincoln Yeoh @ 2001-03-13 07:31 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; drevil@sidereal.kz; +Cc: pgsql-general@postgresql.org
At 08:48 PM 11-03-2001 -0500, Tom Lane wrote:
><drevil@sidereal.kz> writes:
>> I would like to store some images in my Postgres database. These will
>> all be thumbnails, limited to 4k or 5k. I know that PG has an 8k row
>
>bytea is probably your best bet. The 8k limit is toast in 7.1, btw.
What's bytea ?
How do I store and retrieve 0x00 and other binary stuff like this?
Right now I store stuff like this in files on the filesystem. Storing as
base64 in text doesn't sound attractive :). What are the advantages of
using BLOBs vs files on the filesystem?
Cheerio,
Link.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Data type for storing images?
@ 2001-03-13 09:00 drevil@sidereal.kz
parent: Lincoln Yeoh <lyeoh@pop.jaring.my>
0 siblings, 1 reply; 11+ messages in thread
From: drevil@sidereal.kz @ 2001-03-13 09:00 UTC (permalink / raw)
To: pgsql-general@postgresql.org
If bytea can be unlimited size in 7.1, does that mean I can finally
put all my 1gb of MP3s into Postgres, thereby combining all my
favorite stuff?
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: Data type for storing images?
@ 2001-03-13 09:35 Gordan Bobic <gordan@freeuk.com>
parent: drevil@sidereal.kz
0 siblings, 2 replies; 11+ messages in thread
From: Gordan Bobic @ 2001-03-13 09:35 UTC (permalink / raw)
To: pgsql-general@postgresql.org
More to the point, what would be a reason for not using bytea to
replace BLOBs completely?
----- Original Message -----
From: <drevil@sidereal.kz>
To: <pgsql-general@postgresql.org>
Sent: Tuesday, March 13, 2001 9:00 AM
Subject: [GENERAL] Re: Data type for storing images?
>
> If bytea can be unlimited size in 7.1, does that mean I can finally
> put all my 1gb of MP3s into Postgres, thereby combining all my
> favorite stuff?
>
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: Data type for storing images?
@ 2001-03-13 17:06 David Wall <d.wall@computer.org>
parent: Gordan Bobic <gordan@freeuk.com>
1 sibling, 0 replies; 11+ messages in thread
From: David Wall @ 2001-03-13 17:06 UTC (permalink / raw)
To: Gordan Bobic <gordan@freeuk.com>; pgsql-general@postgresql.org; pgsql-interfaces
> More to the point, what would be a reason for not using bytea to
> replace BLOBs completely?
Does anybody know if bytea can be accessed by JDBC yet? I couldn't figure
out how to make it work (setBytes/getBytes) didn't work; only the OID sql
type was working for me with the byte routines.
David
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Data type for storing images?
@ 2001-03-13 17:15 David Wall <d.wall@computer.org>
parent: ryan@paymentalliance.net
0 siblings, 0 replies; 11+ messages in thread
From: David Wall @ 2001-03-13 17:15 UTC (permalink / raw)
To: ryan@paymentalliance.net; pgsql-general@postgresql.org
> I am not sure what your exact purpose is, but in doing a lot of web
> work with pgsql, I usually just store the full path to the image in a
> varchar field and fetch that right into the IMG SRC attribute when I
> need to display the image.
Why would a full path in a IMG tag work? Doesn't your web server use
relative paths based on its document root? If not, you have a serious
security hole allowing people to access any file on your system. <wink>
> I also have modified a simple web based image uploading script so upon
> uploading an image it detects the images width and height and inserts
> that into the DB as well. The script is written in PHP, let me know
> if it would be helpful to send it to you.
I'd be interested in this script. You'll probably need to send it either
"in place" thru the list, or as an attachment directly to me.
Thanks,
David
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Re: Data type for storing images?
@ 2001-03-13 18:25 Tom Lane <tgl@sss.pgh.pa.us>
parent: Gordan Bobic <gordan@freeuk.com>
1 sibling, 0 replies; 11+ messages in thread
From: Tom Lane @ 2001-03-13 18:25 UTC (permalink / raw)
To: Gordan Bobic <gordan@freeuk.com>; +Cc: pgsql-general@postgresql.org
"Gordan Bobic" <gordan@freeuk.com> writes:
> More to the point, what would be a reason for not using bytea to
> replace BLOBs completely?
The fact that encoding/decoding is a pain in the neck :-(. The
lo_read/lo_write interfaces are a relatively convenient way to send
and receive binary data, but the ASCII input-output representation that
bytea uses is not.
We really need some binary-friendly data transmission interface like
lo_read/lo_write for bytea fields before they will be ready to take over
the world. I think Jan has some ideas about how to do that, but it's
not done yet.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2001-03-13 18:25 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-11 22:38 Data type for storing images? drevil@sidereal.kz
2001-03-11 18:40 ` ryan@paymentalliance.net
2001-03-13 17:15 ` David Wall <d.wall@computer.org>
2001-03-12 01:48 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-03-12 02:12 ` David Wall <d.wall@computer.org>
2001-03-12 10:19 ` Frank Joerdens <frank@joerdens.de>
2001-03-13 07:31 ` Lincoln Yeoh <lyeoh@pop.jaring.my>
2001-03-13 09:00 ` drevil@sidereal.kz
2001-03-13 09:35 ` Gordan Bobic <gordan@freeuk.com>
2001-03-13 17:06 ` David Wall <d.wall@computer.org>
2001-03-13 18:25 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox