Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Store image in string

by kejohm (Hermit)
on Mar 14, 2011 at 02:21 UTC ( [id://893018]=note: print w/replies, xml ) Need Help??


in reply to Store image in string

You could store the image data encoded as something like Base64, and then decode it when you print it to file, like this:

#!perl use strict; use warnings; use MIME::Base64; my $data = < base64-encoded data here >; open my $outfile, '>', 'file.gif' or die $!; binmode $outfile; print {$outfile} decode_base64($data); close $outfile;

See the MIME::Base64 manpage for information about Base64 encoding, as well as examples of encoding files.

Update: Oops, sorry Grandfather, you were too quick for me.

Another Update: Link fixed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-16 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found