Loading image data from DB

Devin Asay devin_asay at byu.edu
Thu Apr 6 11:40:34 EDT 2006


Thanks to Chris and Rob I've got this working. Rob proves once again  
how reading the blinking manual can make you look like a genius. (Not  
to imply that Rob is not one, just that in addition to his native  
intelligence he has a passel of common sense.)

Chris's contribution was a necessary part of the solution:

On Apr 5, 2006, at 8:32 PM, chris bohnert wrote:
> when returning the data i do
>
> put "select name,imageData from limage where name='" & tImgName  
> &"'" into tsql
> put revdb_queryblob(tconnectionid,tsql) into tRS
> if not revdb_iseof(tRS) then
>      put revDatabaseColumnNamed(tRS,"name",tPicName)
>      set the text of field "strPicName" to tPicName
>      put revDatabaseColumnNamed(tRS,"imageData",tImageDat)
>      set the imagedata of image "picImage" to tImageDat
>      answer "got a result"
>    end if

But I was only getting a band of random colors on the edge of my  
image object. Then Rob provided the final piece:

On Apr 6, 2006, at 9:18 AM, Rob Cozens wrote:

> All:
>
>> put the imageData of image "picImage" into tBits
>
> I asked this question before, and I still haven't gotten to the  
> point of testing:
>
> Why does everyone choose the imageData of the image instead of its  
> text?
>
> From Rev Dictionary:
>
<snip>
>
> I read this to say, "If you want to retain the original contents of  
> an image, store its text NOT its imageData."

My final solution for loading an image from a database looks like this:

   put word 2 of the selectedline of fld "linenumbers" into tEntryNum
   put "select illustration from vocablist where item_index='" &  
tEntryNum &"'" into tsql
   put revdb_queryblob(connID,tsql) into tRS
   if not revdb_iseof(tRS) then
     put revDatabaseColumnNamed(tRS,"illustration",tImageDat)
     put tImageDat into image "testImg"
   end if

Thanks again.

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list