Android Question insert and read image with blob on server mysql database

taylorw

Active Member
Licensed User
Hi,all i need help for insert and read image with blob need help.
thanks.

'''''''''''This is insert Code
Dim Query As String
Dim InputStream1 As InputStream

InputStream1 = File.OpenInput(Dir, FileName)
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(InputStream1, OutputStream1)
Dim Buffer() As Byte 'declares an empty array
Buffer = OutputStream1.ToBytesArray

If Success Then
IV.SetBackgroundImage(LoadBitmap(Dir,FileName))
Query = "Insert Into tblItem_Maintenance (Item_Picture) Values ('" & Array As Object(Buffer) & "') "
ExecuteRemoteQuery(Query,"")
Else

End If
 

KMatle

Expert
Licensed User
Longtime User
Just convert it to Base64 and use LONGTEXT (or so) as the culumn's data type. So you just handle text's. Very easy. Convert it back when needed.

There are examples in the forum. Just search for Base64.

Note: If you need to handle a huge amount of images it might be better to store an index in your db and store the image as a file (search the forum how to store a file in php like multipart, etc.)
 
Upvote 0

M.LAZ

Active Member
Licensed User
Longtime User
The PHP script doesn't support blobs. You can switch to RDC which does support blobs (and has other advantages).
i don't have a server and my hosting is shared , could i use RDC or Jrdc2?
 
Upvote 0
Top