hello All,
have been trying to save a image from a base64 string.. the below code works perfectly
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
as long as the input string is of type "data:image/png;base64"
but fails if the input string is of type "data:image/svg+xml;base64"
Can we not decode svg/xml with stringutils? What am i missing here?
regards
carloz
			
			have been trying to save a image from a base64 string.. the below code works perfectly
			
				B4X:
			
		
		
		Sub ImageUri(uri As String) As Bitmap
   Dim s As String
   Dim n As Int
   n = uri.IndexOf(",")
   Log("n is " & n)
   If n < 0 Then
      s = uri
   Else
      s = uri.SubString(n+1)
   End If
   Dim su As StringUtils
    Dim bytes() As Byte = su.DecodeBase64(s)
   
    Dim In As InputStream
   In.InitializeFromBytesArray(bytes, 0, bytes.Length)
    Dim bmp As Bitmap
    bmp.Initialize2(In)
    In.Close
    Return bmp
End Sub
	but fails if the input string is of type "data:image/svg+xml;base64"
Can we not decode svg/xml with stringutils? What am i missing here?
regards
carloz