| View previous topic :: View next topic |
| Author |
Message |
Sam Guest
|
Posted: Mon Sep 15, 2003 4:10 pm Post subject: Using TIdBase64Decoder to decode a PNG image from XML docume |
|
|
Hello group,
I am looking for examples or better documentation on using the
TIdBase64Decoder component to decode data. I am using Delphi6 w/ Indy8.0.25.
What I have is an XML document and one of its nodes contains a PNG image.
The image is encoded using Base64 encoding. I am attempting to decode the
encoded data to a memory stream and then load the image using a TGraphic
descendant.
But I am stuck at decoding.
Does anyone know of better examples on using TIdBase64Decoder to decode?
Delphi help isn't any help regarding the TIdBase64Decoder component. Or
should I be using something else?
TIA
-Sam
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Sep 15, 2003 5:26 pm Post subject: Re: Using TIdBase64Decoder to decode a PNG image from XML do |
|
|
"Chad Z. Hower aka Kudzu" <cpub (AT) hower (DOT) org> wrote
| Quote: | The Indy 9 decoders are much easier to use.
|
In other words, completely uninstall and remove the version of Indy that
ships with Builder, and then go to http://www.indyproject.org and install a
newer version.
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com)[/url].
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03
|
|
| Back to top |
|
 |
Ciaran Costelloe Guest
|
Posted: Mon Sep 15, 2003 7:14 pm Post subject: Re: Using TIdBase64Decoder to decode a PNG image from XML do |
|
|
"Sam" <s.changtum (AT) interton-usa (DOT) com> wrote
| Quote: |
"Chad Z. Hower aka Kudzu" <cpub (AT) hower (DOT) org> wrote in message
news:Xns93F7C5A1DA9FEcpub (AT) 127 (DOT) 0.0.1...
The Indy 9 decoders are much easier to use.
Okay - sounds great, but before I upgrade, can you tip me toward some
Indy8
decoding examples.
The XML node I need to decode is rather large.
|
Get Indy 9's IdIMAP4.pas and do a search for "decode" (you don't need to
install or use it), it has to decode parts of emails, which I imagine is
similar.
Ciaran
--
ELKNews - Get your free copy at http://www.atozedsoftware.com
|
|
| Back to top |
|
 |
Sam Guest
|
Posted: Mon Sep 15, 2003 7:23 pm Post subject: Re: Using TIdBase64Decoder to decode a PNG image from XML do |
|
|
"Chad Z. Hower aka Kudzu" <cpub (AT) hower (DOT) org> wrote
| Quote: | The Indy 9 decoders are much easier to use.
|
Okay - sounds great, but before I upgrade, can you tip me toward some Indy8
decoding examples.
The XML node I need to decode is rather large.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Sep 15, 2003 11:27 pm Post subject: Re: Using TIdBase64Decoder to decode a PNG image from XML do |
|
|
"Sam" <s.changtum (AT) interton-usa (DOT) com> wrote
| Quote: | Okay - sounds great, but before I upgrade, can you tip me
toward some Indy8 decoding examples.
|
Have a look at the following code I submitted awhile back. Although it was
written and posted for C++Builder, it should be portable to Delphi as well:
http://groups.google.com/groups?selm=3ed7b8da%241%40newsgroups.borland.com
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com)[/url].
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Tue Sep 16, 2003 12:25 am Post subject: Re: Using TIdBase64Decoder to decode a PNG image from XML do |
|
|
"Sam" <s.changtum (AT) interton-usa (DOT) com> wrote in
news:3f65c931 (AT) newsgroups (DOT) borland.com:
| Quote: | Does anyone know of better examples on using TIdBase64Decoder to
decode? Delphi help isn't any help regarding the TIdBase64Decoder
component. Or should I be using something else?
|
The Indy 9 decoders are much easier to use.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Need extra help with an Indy problem?
http://www.atozedsoftware.com/indy/experts/support.html
ELKNews - Get your free copy at http://www.atozedsoftware.com
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Tue Sep 16, 2003 5:07 am Post subject: Re: Using TIdBase64Decoder to decode a PNG image from XML do |
|
|
"Sam" <s.changtum (AT) interton-usa (DOT) com> wrote in news:3f65f650$1
@newsgroups.borland.com:
| Quote: | Okay - sounds great, but before I upgrade, can you tip me toward some Indy8
decoding examples.
|
Indy 8's decoders are not easy to use. Im advising you to go to 9, not only
because of bug fixes, but for your own benefit.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Want to keep up to date with Indy?
Join Indy News - it free!
http://www.atozedsoftware.com/indy/news/
ELKNews - Get your free copy at http://www.atozedsoftware.com
|
|
| Back to top |
|
 |
Sam Guest
|
Posted: Fri Sep 19, 2003 3:32 pm Post subject: Re: Using TIdBase64Decoder to decode a PNG image from XML do |
|
|
Okay this thread is done.
Thankyou Chad, Remy and Ciaran.
Yes I did upgrade to Indy9 and I like it better than Indy8.
I used Open XML to process the XML part just because I like natvie Delphi
objects.(http://www.philo.de)
I used TPNGImage to add PNG image support to Delphi.
(http://pngdelphi.sourceforge.net/)
The code:
decoder: TIdDecoderMIME;
function GetImage(node: TdomNode): TPNGObject;
var
binaryData: string;
stream: TMemoryStream;
png: TPNGObject;
begin
Result := nil;
binaryData := AnsiReplaceStr(node.nodeValue, #13, '');
binaryData := AnsiReplaceStr(binaryData, #10, '');
stream := TMemoryStream.Create();
try
decoder.DecodeToStream(binaryData, stream);
stream.Position := 0;
png := TPNGObject.Create();
png.LoadFromStream(stream);
finally
stream.Free();
end;
Result := png;
end;
|
|
| Back to top |
|
 |
|