Re: Image data from MySQL into TreeView




Dirk van der Walt said:
I'm using MySQL to store my icons and some other graphics
in.
I plan to create a web as well as a perl-Gtk front end to
the DB. (Thus I have to store the graphics in the DB
itself)

I presume, then, that you have compressed image data in your database, e.g.
png or jpg files.

I want to use these icons in my treeview.
I've thought of dumping these icons into temp files and
then create them by
print TEMP_FILE ($icon_from_db)
pix => Gtk2::Gdk::Pixbuf->new_from_file(<temp_file_name>)

Yuck.  Temp files suck.  :-)

Is there a quicker and more proper way?

Yes.  Use a Gtk2::Gdk::PixbufLoader and pretend you're doing an incremental load.


See also:
http://mail.gnome.org/archives/gtk-perl-list/2005-January/msg00142.html
  (explanation of when to use new_from_data and when to use a pixbuf loader)

http://mail.gnome.org/archives/gtk-perl-list/2004-August/msg00017.html
  (how to use a pixbuf loader to do what you want to do)


(either the mailer or the list archives put linebreaks into the long URLs in
the archived messages, so you'll have to cut, paste, & edit.  sorry.)

-- 
muppet <scott at asofyet dot org>



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