Advertisement
Advertisement
| 07.16.2008 at 03:38PM PDT, ID: 23571580 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: |
this is the part of the xml that has the image.
<Image ImageFormat="PNG" dt:dt="bin.base64" xmlns:dt="urn:schemas-microsoft-com:datatypes">iVBORw0KGgoAAAANSUhEUgAAAp0AAAIvAQMAAAAMGfIDA....AAAAAElFTkSuQmCC</Image>
I'm using the following VBA:
Const sBASE_64_CHARACTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Function fGetWebPost(strSourceURL As String, strRequest As String)
Dim xmlServerHttp As Object, co As Long, s As String
Set xmlServerHttp = CreateObject("MSXML2.ServerXMLHTTP.4.0")
With xmlServerHttp
.Open "POST", strSourceURL, False
'.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send (strRequest)
s = .responseText
End With
fGetWebPost = s
Open "c:\test.png" For Output As #1
Print #1, Base64decode(Mid(s, 1312, 11798))
Close #1
Set xmlServerHttp = Nothing
End Function
'**************************************
' Name: Base 64 Encode / Decode
' Description:Base 64 encodeing is used
' to convert binary files to a "safe" form
' at for transporting files through smtp (
' email) and other protocols. It is also u
' sed for basic authentication. With this
' code, you can decode the current UserNam
' e/Password who is visiting a protected p
' age on your site by requesting one of th
' e serverVariables.
' By: Lewis E. Moten III
'
' Inputs:These two algorithims are expec
' ting a string that is to be encoded or d
' ecoded.
'
' Returns:Returns a string that was enco
' ded or decoded.
'
' Side Effects:The string returned from
' encoding with Base64 is not delimited by
' cariadge returns. Some formats that I ha
' ve seen in the past, such as email - may
' continue to the next line after the 80th
' character.
'Also, these functions work With Strings. (Not binary data). When working with binary data, some changes may need To come into place.
'
'This code is copyrighted and has ' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/vb/scripts/Sho
' wCode.asp?txtCodeId=6268&lngWId=4 'for details. '**************************************
' --------------------------------------
' ---------------------------------------
Function Base64decode(ByVal asContents)
Dim lsResult
Dim lnPosition
Dim lsGroup64, lsGroupBinary
Dim Char1, Char2, Char3, Char4
Dim Byte1, Byte2, Byte3
If Len(asContents) Mod 4 > 0 Then asContents = asContents & String(4 - (Len(asContents) Mod 4), " ")
lsResult = ""
For lnPosition = 1 To Len(asContents) Step 4
lsGroupBinary = ""
lsGroup64 = Mid(asContents, lnPosition, 4)
Char1 = InStr(sBASE_64_CHARACTERS, Mid(lsGroup64, 1, 1)) - 1
Char2 = InStr(sBASE_64_CHARACTERS, Mid(lsGroup64, 2, 1)) - 1
Char3 = InStr(sBASE_64_CHARACTERS, Mid(lsGroup64, 3, 1)) - 1
Char4 = InStr(sBASE_64_CHARACTERS, Mid(lsGroup64, 4, 1)) - 1
Byte1 = Chr(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)
Byte2 = lsGroupBinary & Chr(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)
Byte3 = Chr((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))
lsGroupBinary = Byte1 & Byte2 & Byte3
lsResult = lsResult + lsGroupBinary
Next
Base64decode = lsResult
End Function
|