DB Image Retrieval Problem
Posted: Sat Aug 08, 2009 9:59 pm
Hello all!
Hoping someone can tell me what I'm doing wrong here.
My stack is a GUI for an SQLlite DB. I have a db table, then in runrev I have a "get picture" button, an image object, and a button set for db record navigation.
The get picture button works correctly, or at least I assume so, at getting an image from an open/save type dialog, b64 encoding it, and storing that in the db table, in an appropriate blob field. My problem is in retrieving that image data from the table and putting it into the image object when navigating records.
my command for retrieving the pict is invoked by:
get_pict "my_target_image_name"
the corresponding function is as follows:
As you can see, I have tried 2 strategies and neither works, and I'm not sure why. The results of using the "set imageData" method are either a black box or a noise image being put into the image object, while the results of the "put b64dec into image" method are apparently null, ie, the image object appears empty.
So, what am I doing wrong?
FYI, I tried and rejected the "set imageSource" method (which DID work in both directions), as it relies on the picture still being at that specific location on the filesystem for all eternity to remain visible to runrev. If that file moves, is deleted, etc, runrev won't be able to show the image. Therefore, I thought it best to import the image into a DB table, where I'm storing everything else in my app anyway.
Hoping someone can tell me what I'm doing wrong here.
My stack is a GUI for an SQLlite DB. I have a db table, then in runrev I have a "get picture" button, an image object, and a button set for db record navigation.
The get picture button works correctly, or at least I assume so, at getting an image from an open/save type dialog, b64 encoding it, and storing that in the db table, in an appropriate blob field. My problem is in retrieving that image data from the table and putting it into the image object when navigating records.
my command for retrieving the pict is invoked by:
get_pict "my_target_image_name"
the corresponding function is as follows:
Code: Select all
command get_pict fldname
global gConID
global workingrecID
put "SELECT A.pictdata FROM mytable AS A WHERE A.recID=" & workingrecID & ";" into tSQL
put revQueryDatabase(gConID,tSQL) into tResultID
put revDatabaseColumnNamed(tResultID,"pictdata") into tPictdata
//set the imageData of image fldname to base64decode(tPictdata)
put base64decode(tPictdata) into image fldname
end get_pict
So, what am I doing wrong?
FYI, I tried and rejected the "set imageSource" method (which DID work in both directions), as it relies on the picture still being at that specific location on the filesystem for all eternity to remain visible to runrev. If that file moves, is deleted, etc, runrev won't be able to show the image. Therefore, I thought it best to import the image into a DB table, where I'm storing everything else in my app anyway.