Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Display image from Base64 string

31 views
Skip to first unread message

Sane Eric

unread,
Sep 2, 2006, 2:57:34 PM9/2/06
to
I can get from my database a Base64 string representation of a PNG
image. I need to be able to unencode(?) this so that I can render it as
an image via ASP. Architecture is PostgreSQL -> VB6 -> ASP (none of
this is .Net, all old school).

I have validated that the string in the DB is valid Base64.

How can I read the string and render the image, I dont mind where in the
tiers this is done?

Thanks

Sane E

*** Sent via Developersdex http://www.developersdex.com ***

mayayana

unread,
Sep 2, 2006, 6:28:40 PM9/2/06
to
There are several versions here:
http://www.xbeat.net/vbspeed/c_Base64Dec.htm

You might have to remove carriage returns
first. Attachments are created as Base64 strings with
carriage returns every 76 characters. Those are
not actually part of the Base64 string. (But if it's
in your database it may not have returns in the string.)

Once you get the bytes from the Base64 just write that
to disk with a "Put".

Mike D Sutton

unread,
Sep 4, 2006, 7:49:19 AM9/4/06
to
> Once you get the bytes from the Base64 just write that
> to disk with a "Put".

If the image is for display then the OP can use the PtrToPicture() call in the OLEPicture library on my site to go
directly from the decoded Base64 buffer into the picture, without having to go via the disk.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: ED...@mvps.org
WWW: Http://EDais.mvps.org/


0 new messages