
January 13th, 2007, 12:44 PM
|
 |
Contributing User
|
|
|
|
VB6?
Here we go...
Code:
Public Function ImageToString(ImagePath As String) As String
Dim FileHandle As Integer
Dim Data As String
FileHandle = FreeFile
Open ImagePath For Binary As FileHandle
Data = String(LOF(FileHandle), " ")
Get FileHandle, , Data
Close FileHandle
End Function
Public Sub StringToImage(Data As String, ImagePath As String)
Dim FileHandle As Integer
FileHandle = FreeFile
Open ImagePath For Binary As FileHandle
Put FileHandle, , Data
Close FileHandle
End Sub
... or something along those lines anyway. Dont forget to check to see iof the bmp file already exists before overwriting it. If it does already exist, make sure that you delete the old iimage. Search the internet for VB6 tutorials on how to read/write data to/from a database.
Example how to use it...
Code:
' Stores the image into a string
Dim ImageData As String
ImageData= ImageToString("C:\My Image.bmp")
' Stores the string into a new file, thus copying the above bmp file
StringToImage(ImageData, "C:\My New Image.bmp")
Hope that helps.
Last edited by LozWare : January 13th, 2007 at 12:48 PM.
|