uups tippfehler:
das ist codieren...
VB.NET-Quellcode
- Public Function ImageToBase64(ByVal oImage As Image) As String
- If oImage IsNot Nothing Then
- With New System.Drawing.ImageConverter
- ' Image in Byte-Array umwandeln
- Dim nBytes() As Byte = CType(.ConvertTo(oImage, GetType(Byte())), Byte())
- ' Byte-Array in Base64-codierten String umwandeln
- Return (Convert.ToBase64String(nBytes, _
- Base64FormattingOptions.InsertLineBreaks))
- End With
- Else
- ' Leerstring zurückgeben
- Return ("")
- End If
- End Function
das ist codieren...