Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Save and Load Data from MySQL DB

by stefbv (Curate)
on Nov 03, 2011 at 16:33 UTC ( [id://935707]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://935707]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found