Re: save image and display image from postgresql



Le mercredi 23 juillet 2008 Ã 19:13 +0800, paragasu a Ãcrit :
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.


You could use gdk_pixdata_from_pixbuf(), gdk_pixdata_serialize() to
store the image on the database server as a BLOB or converted to a
string encoded in Base64. 
And use gdk_pixdata_deserialize(), gdk_pixbuf_from_pixdata() to convert
the data back to a GdkPixbuf for display.

See
http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-inline.html


But, IMHO, storing image in a database is not the best way: 
storing in database the path to an image stored on a filesystem could be
a better idea (on a single computer, the application will benefit from
the filesystem cache).

Regards

-- 
Yann Droneaud <ydroneaud mandriva com>





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