Loading image data from DB
Devin Asay
devin_asay at byu.edu
Wed Apr 5 18:37:34 EDT 2006
I know this can be done, but it's got me stumped. Nothing conclusive
from archives.
I want to store image data in a mysql database and then show it in
an image object in Rev. I successfully loaded an image into a field
of type longblob. I know the data is there and that it's valid.
This is what I tried to load the image data:
global connID -- my connection id
on mouseUp
if connID is empty then
answer "You need to connect to the database first."
exit to top
end if
put word 2 of the selectedline of fld "linenumbers" into tEntryNum
put "select illustration from vocablist where item_index = " &
tEntryNum into tQuery
put revDataFromQuery(,,connID,tQuery) into tData
set the imagedata of img "testImg" to tData
end mouseUp
The query ends up something like this:
select illustration from vocablist where item_index = 1290
All I ever get in the tData variable is four random characters; ÿØÿà
I know the image data in the database table is valid because I can
set up an automatic query in the Database Query Builder, then set the
image object to automatically load that data, and it works. I've
tried to find the scripting in the Database Query Builder stack that
does this, but no luck.
Has anyone successfully done this who can share the secret to making
it work?
Thanks,
Devin
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list