Re: save image and display image from postgresql



2008/7/23 paragasu <paragasu gmail com>:
i am very new to gtk programming. I am sorry for this beginner
questions, but after asking
google i fail the get the right answer. I hope this mailing list will help me.

anyone can please point me a way on how to save image to postgresql
database and
display the image again.

To save an image in Postgres, you can sither use a blob type, a binary
string, or convert your picture to an ASCII string (in base64 for
example) and use a normal string field. Loading it back is a matter of
doing the reverse.

As to display the image in GTK+, you can use
gtk_image_new_from_pixbuf() along with a GdkPixbufLoader. This is
what's done in Libgnomedb (for example in
http://svn.gnome.org/viewvc/libgnomedb/trunk/libgnomedb/plugins/common-pict.c?revision=1686&view=markup).

Regards,

Vivien



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