Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert a jpeg to Base64 format
Message
From
13/11/2003 00:36:04
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Title:
Convert a jpeg to Base64 format
Miscellaneous
Thread ID:
00849408
Message ID:
00849408
Views:
93
Hi,

I'm trying to send an email with a jpeg using smtp with MIME formatting.  My understanding is that I need to encode the jpeg into Base64 format.  I have tried the class base64c of the base64.prg from http://fox.wikis.com/wc.dll?Wiki~Base64~SoftwareEng.  I have also tried to use the strconv function in VFP 8.  I got different results from them.

My coding is very straightforward:

lcJPEG = FileToStr("c:\sample.jpg")
lcJPEG64 = strconv(lcJPEG, 13)


I tested both ways using a text file which has 50 characters with the last 2 characters being <?  Using the base64c, the encoded text file will have PD8A at the end but using my coding will have PD8=  I know that <? is encoded as PD8  If PD8A should be the correct one, then VFP 8 has a bug.:-)

After I have encoded a jpeg using either way, the email received by the recipient is still the encoded file if the email address is a yahoo email address.  I kind of expect the email should be decoded automatically.:-(  I hope someone can help me on this.


Thank you for any help,

Peter
Next
Reply
Map
View

Click here to load this message in the networking platform