Hi Erel,
This is my code, everything is fine but when I'm trying to save on my table
error appear on BufferI said that "Object converted to string"
Dim In As InputStream
Dim bmp As Image
Dim out As OutputStream
Dim bufferI() As Byte
Sub BtnBrowse_Click
Dim fileimg As String
Dim SelectImg As FileChooser
SelectImg.Initialize
'SelectImg.SetExtensionFilter("Image", "*.jpg")
SelectImg.Title = "Select your photo"
fileimg = SelectImg.ShowOpen(MainForm)
If fileimg <> "" Then
IV.SetImage(fx.LoadImageSample(File.GetFileParent(fileimg), File.GetName(fileimg), IV.Width, IV.Height))
bufferI = ImageToBytes(IV.GetImage)
End If
End Sub
Public Sub ImageToBytes(Image As B4XBitmap) As Byte()
out.InitializeToBytesArray(0)
Image.WriteToStream(out, 100, "JPEG")
out.Close
Return out.ToBytesArray
End Sub
Public Sub BytesToImage(bytes() As Byte) As B4XBitmap
In.InitializeFromBytesArray(bytes, 0, bytes.Length)
bmp.Initialize2(In)
Return bmp
End Sub