Loading image data from DB
Devin Asay
devin_asay at byu.edu
Thu Apr 6 16:50:15 EDT 2006
Now I've figured out the other half of this cycle: how to upload
image data to a database. The trick seems to be that you upload and
download the image data as *text* (as opposed to the imageData of the
image, which is binary.) I may have this all wrong conceptually, but
that's how it finally made sense to me. This is how I'm doing it for
files external to the stack:
put fld "entryNumber" into tEntryNum
put "binfile:" & the filename of image "testImg" into fileNm
put url fileNm into tBits
put "update vocablist set illustration = :1 where item_index='" &
tEntryNum & "'" into tQuery
get revdb_execute(connID, tQuery,"*btBits") -- ("*b" tells it to
send the text as a binary stream.)
For internal files this worked:
put fld "entryNumber" into tEntryNum
put image "leaf" into tBits
put "update vocablist set illustration = :1 where item_index='" &
tEntryNum & "'" into tQuery
get revdb_execute(connID, tQuery,"*btBits")
I hope this saves someone some time and frustration.
Devin
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list