Search Postgresql Archives

Re: Storing images in a field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Együd Csaba wrote:
> Hi All,
> I use PG 7.3.2 an 7.4.1 on RH 7.1.
> I'd like to store small (~ 100x100 px jpeg, or gif) images in a field in
> binary format.
> I tried to understand the documentation of the large objects but I'm afraid
> I coluldn't.
> I found some functions to import and export binary files into the db, but
> these functions work on the server side.
> How can I insert a block of binary data into a given field form the client
> (WinXP, pgsqlODBC 7.03.01)? And on the other side how can I retrive that
> data from there, how can I delete or modifay that?
> 
> In general which data type is the most powerful for this. The only purpose
> of this field to store a photo or drawing of the product represented by the
> record. It's not required to be parsed. Is it possible to have it compressed
> or it should be done by the client?

Numerous methods exist - large objects, bytea fields, TEXT fields (ie, 
base64 convert the data and store as a big string), and of course, 
storing a path in the filesystem to the image (has pros and cons). In 
fact, only about a week ago was there a discussion on this topic.

Which makes me wonder:

Since this is such a common request, shouldn't there be a FAQ regarding 
the procedure? Heck, even if all it consisted of was the archived 
messages strung together, there should be enough q&a involved in all of 
those exchanges to answer this question many times over.

I know, I know - itch, scratch, why don't I do it? If I had the time 
(and if I had actually ever done the exercise), I would make a FAQ or 
something on the topic and post it. Unfortunately, I have never had the 
need to store images in a DB (shocking!). However, I do know enough 
about the topic to know that it is a common question, one that should 
already be answered in just about every manner possible.

In fact, it likely is - so why does this same question seem to pop up on 
a regular basis? I realize that there are basic questions, and all need 
to be answered. I also realize the everybody was a "beginner" at one 
time or another. But this question should be completely and fully 
answered in some form on the internet - because it is a *basic* 
component of every e-commerce site. Are people really reinventing the 
wheel this much?

Andrew Ayers
Phoenix, Arizona

-- CONFIDENTIALITY NOTICE --

This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email, and delete the message. Thank you.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux