in reply to Save and Load Data from MySQL DB

This code is from an old application, you have to experiment a little with it, it should work but not tested lately.

Note that I used base64 encoding and the data was saved to a BLOB field of subtype text in a Firebird database.

use MIME::Base64; ... #- New Label my $label = $pane->Label( -width => 646, -height => 486 )->pack; #- Default empty image my $jpgimg = $label->Photo( -format => 'jpeg', -file => '', ); $label->configure( -image => $jpgimg ); #- Process image open my $fh, '<', $img_file or die "Can't open file ", $img_file, ": $!"; binmode $fh; my $photo = do { local $/; <$fh> }; close $fh; my $stream = encode_base64($photo) or die $!; #- Load image in Label $label->blank; $label->configure( -format => 'jpeg', -data => $stream ); #- Retrieve value for DB insert my $value = $label->cget( -data );

Regards, Stefan