Re: Storing images in a field - Mailing list pgsql-general
From | Andrew Ayers |
---|---|
Subject | Re: Storing images in a field |
Date | |
Msg-id | 40840757.6030709@eldocomp.com Whole thread Raw |
In response to | Storing images in a field (Együd Csaba <csegyud@vnet.hu>) |
List | pgsql-general |
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 informationthat is privileged, confidential and exempt from disclosure under applicable law. If you are not the intendedaddressee, 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 thismessage in error, please immediately advise the sender by reply email, and delete the message. Thank you.
pgsql-general by date: