Re: Read Base64 string to write a .gif (or other content type)
- From: AC [MVP MCMS] <swamplander@xxxxxxxxx>
- Date: Sat, 19 Nov 2005 19:44:52 -0800
Hello James,
This will work for images... but will it work for other content types (ZIP, DOC, XLS)?
-- -AC [MVP MCMS] http://www.andrewconnell.com http://www.andrewconnell.com/mvp
Create a MemoryStream from the byte[]. Use the FromStream() and Save() methods of System.Drawing.Image.
AC [MVP MCMS] wrote:
Hello James,
Thanks... I guess I should have been more specific. I have that part, converting the string to a byte array. But for images, I've noticed that there's a header at the start of the file (appears to be just plain text, but not sure)... for example a gif has GIF[version] at the start of the file. I've tried writing out "GIF89a" at the start and then the byte array, but that didn't work. Then I tried writing the GIF89a to a separate byte array, write that out and then write the data stream byte array... but that didn't work. I've seen some examples in this NNTP about using the BinaryWriter, and comments by Jon Skeet how that's not necessary, but having a hard time finding a single example of how to write this out on your own. I'm not only interested in writing out GIF's, but also BMPs, JPEG, PNGs, ZIPs, DOCs, XLSs, etc...
Ideas?
How 'bout System.Convert.FromBase64String ()
Home: www.noveltheory.com Work: www.njtheater.com Blog: www.honestillusion.com Day Job: www.partsearch.com "AC [MVP MCMS]" <swamplander@xxxxxxxxx> wrote in message news:9c8265c7295518c7ba66586abce1@xxxxxxxxxxxxxxxxxxxxxxx
Any pointers on how to (1) read a Base64 encoded string from a text file and (2) write it to a binary file?
I have a ton of files that are being generated from a legacy system. Each file contains a (1) content type one one line, a (2) filename, and (3) the encoding type (seems to always be Base64, followed by the encoded string. A process will be to read the content type and filename, then create a new binary file and write out the converted base64 string.
Ideas?
-- -AC [MVP MCMS] http://www.andrewconnell.com http://www.andrewconnell.com/mvp
.
- Follow-Ups:
- Re: Read Base64 string to write a .gif (or other content type)
- From: James Curran
- Re: Read Base64 string to write a .gif (or other content type)
- References:
- Re: Read Base64 string to write a .gif (or other content type)
- From: James Curran
- Re: Read Base64 string to write a .gif (or other content type)
- Prev by Date: Re: Read Base64 string to write a .gif (or other content type)
- Next by Date: How to go about removing lines of text at the top of a RichTextBox
- Previous by thread: Re: Read Base64 string to write a .gif (or other content type)
- Next by thread: Re: Read Base64 string to write a .gif (or other content type)
- Index(es):
Relevant Pages
|