realbasic-nug
[Top] [All Lists]

Re: DecodeBase64 problem

To: Igy Castrillo <igy dot castrillo at gmail dot com>, REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: DecodeBase64 problem
From: Peter De Berdt <peter dot de dot berdt at pandora dot be>
Date: Thu, 30 Sep 2004 12:48:05 +0200
Cc:
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20040929220700 dot 0C6CB4A1D5B at lists dot realsoftware dot com> <665df4d704093003386825ee68 at mail dot gmail dot com>

On 30 Sep 2004, at 12:38, Igy Castrillo wrote:

Hello everyone.

This is probably an old topic -- my apologies. I've finally managed to
EncodeBase64 my JPEG, GIF & other graphic files, convert them to
strings and store them as blobs in my MySQL and RB databases.
Unfortunately, I can't figure out how to convert the Base64 decoded
binaries back to picture format so they can be displayed in my RB
front-end. The RB Language Reference & User's Guide doesn't really
help (no luck in the net either).

I've only gotten as far as:

Dim b As BinaryStream
Dim s As String
Dim f As FolderItem

f=GetOpenFolderItem("image/x-pict;image/x-bmp;image/jpeg;image/gif; image/tiff")
...
//Convert pic to string
b=f.OpenAsBinaryFile(False)
s=b.Read(b.length)
b.Close
self.imagefield.text=EncodeBase64(s,0)
...
//Convert string to pic
s=DecodeBase64(self.imagefield.text)
b.Write s
self.photofield.backdrop.graphics.drawpicture b,0,0
//this, of course, doesn't work as 'b' is being passed as a string

... and that's it -- a blank wall. I've no idea how to convert the
binarystream to a picture (not to a file) that can be displayed in my
Canvas control's backdrop. Any help completing this code would really
be appreciated.

Without the MBS plug-in, you need to write the content to a file (just create a random file in the TemporaryFolder) and open the file as picture. There may be other plug-ins (maybe even free ones), but I'm sure the MBS plug-in does it.


Best regards

Peter De Berdt

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>