Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to translate SQL Picture (binary array) to DBF Pictu
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00458797
Message ID:
00458914
Views:
23
Hi!

Ok, here it is. Hope this makes some sense for you. I can convert this to VFP sample code if needed.

Image retrieving part sample:
'Response.ContentType="image/gif";
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
conn.Open ...
SQL = "SELECT MyTable.MyImage FROM MyTable WHERE MyTable.ID=" & Request.QueryString("id")
rs.open SQL, conn ,3 ,3
Set Field = rs("MyImage")
BSize = 4096
FLength = Field.ActualSize
NumBlocks = FLength \ BSize
Left = FLength Mod BSize
Response.BinaryWrite Field.GetChunk(Left)
For i = 1 To NumBlocks
Response.BinaryWrite Field.GetChunk(BSize)
Next

Image saving part sample:

Function SToB(Str)
Dim I, B
For I=1 to len(Str)
B = B & ChrB(Asc(Mid(Str,I,1)))
Next
SToB = B
End Function

....
rset.Fields("MyImage").AppendChunk(Server.HTMLEncode(Form("MyImage").Item));
if (Form("MyImage").File != "") {
rset.Fields("MyImage").AppendChunk (SToB(Form("MyImage").Item))
}
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform