XML Base64 -> File
From: Craig (chester_at_theantons.co.za)
Date: 05/27/04
- Next message: Craig: "Re: XML Base64 -> File - Raw XML Data"
- Previous message: Maarten Wiltink: "Re: Adding plugins to my application"
- Next in thread: Craig: "Re: XML Base64 -> File - Raw XML Data"
- Reply: Craig: "Re: XML Base64 -> File - Raw XML Data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 27 May 2004 09:19:06 +0100
I have an XML node with loads of data, (I have replied to this message with
the data).
I am trying to convert it back to it's origional form, which I believe is a
gif.
Here is the code I am using:
type
TfrmEncoderDecoder = class(TForm)
mimeEncoder: TIdEncoderMIME;
mimeDecoder: TIdDecoderMIME;
....
function TfrmEncoderDecoder.DecodeFile ( inString : String ) : TGraphic;
var
ZLibStream : TMemoryStream;
FileName : String;
begin
Filename := 'c:\' + createRandomName( 8 ) + '.gif';
ZLibStream := TMemoryStream.Create;
mimeDecoder.DecodeToStream( inString, ZLibStream);
zlibStream.SaveToFile( Filename );
// Will process file here
deletefile( Filename );
end;
This DOES seem to process the string OK, and save to a file. However, as I
save the image, and try view it, it's unable to be viewed.
I then (Using a hex editor) view the new file, and see what seems to be a
filename built into the file, as well as the words 'gif' and other legible
words. Indicating to me that the docoding went OK.
I then viewed another pefect gif, and saw that it started with the word gif.
I then removed all the stuff before the word 'gif' in my image, and try view
it, and I get an image, pure black, but it does preview!
Has anyone got any idea what I may be doing wrong? Maybe using the wrong
encoding? The wrong way maybe?
Attached is the raw XML from the node in question (As a reply to this
message).
- Next message: Craig: "Re: XML Base64 -> File - Raw XML Data"
- Previous message: Maarten Wiltink: "Re: Adding plugins to my application"
- Next in thread: Craig: "Re: XML Base64 -> File - Raw XML Data"
- Reply: Craig: "Re: XML Base64 -> File - Raw XML Data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|