I am storing jpeg images to a BLOB table in a Valentina DB with a LiveCode Front and the SQL Yoga Library
I can easily retrieve the binary data from the DB BLOB field "GYN_TF" and store it in a variable.
put sqlquery_createObject("GYN_TF") into theQueryA
sqlquery_set theQueryA, "select clause", "GYN_IMAGES"
put "GYN_TF.DBID = $" into theConditions
replace "$" with CaseN in theConditions
sqlquery_set theQueryA, "Conditions", theConditions
sqlquery_retrieveAsArray theQueryA, theDataA
put the result into theError
put the keys of theDataA[1] & cr & theDataA[1]["GYN_IMAGES"] into ImageHold1
delete line 1 of ImageHold1
How do I convert the binary data in the variable ImageHold1 back to an image for display in LiveCode?
Thanks in advance,
Jorge
Converting Data From Blob Table For Display
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Converting Data From Blob Table For Display
Hola Jorge,
welcome to the forum!
Can't you just:
...
put tBlobDataFromDB into img "your image here"
...
Or:
...
set the text of img "your image here" to tBlobDataFromDB
...
Just guessing, never worked with BLOB data before.
I think this should be exactly like you imported the images into the database,
only the other way round
Best
Klaus
welcome to the forum!

Can't you just:
...
put tBlobDataFromDB into img "your image here"
...
Or:
...
set the text of img "your image here" to tBlobDataFromDB
...
Just guessing, never worked with BLOB data before.
I think this should be exactly like you imported the images into the database,
only the other way round

Best
Klaus
Re: Converting Data From Blob Table For Display
Klaus:
Thanks for the reply.
The data that I retrieve from the BLOB fld looks like this and represents the image (excerpt of first 2 lines of the data) -
" ˇÿˇ‡JFIFHHˇ‚§ICC_PROFILEîappl mntrRGB XYZ ŸacspAPPLapplˆ÷”-appldescodscmxVcprt–8wtptrXYZgXYZ0bXYZDrTRCXchadh,bTRCXgTRCXdescGeneric RGB ProfileGeneric RGB Profilemluc..."
I am not sure what function in Live Code to use to process the data and covert it back to an image for display.
Thanks,
Jorge
Thanks for the reply.
The data that I retrieve from the BLOB fld looks like this and represents the image (excerpt of first 2 lines of the data) -
" ˇÿˇ‡JFIFHHˇ‚§ICC_PROFILEîappl mntrRGB XYZ ŸacspAPPLapplˆ÷”-appldescodscmxVcprt–8wtptrXYZgXYZ0bXYZDrTRCXchadh,bTRCXgTRCXdescGeneric RGB ProfileGeneric RGB Profilemluc..."
I am not sure what function in Live Code to use to process the data and covert it back to an image for display.
Thanks,
Jorge
Re: Converting Data From Blob Table For Display
Hola Jorge,
the BLOB data look OK, see the "JFIF" at the beginning?
That's the binary representation of hte JPEG imge, just like what you will see, if you open an image in a TEXT editor.
Did you try my proposals?
That should work!
Best
Klaus
the BLOB data look OK, see the "JFIF" at the beginning?
That's the binary representation of hte JPEG imge, just like what you will see, if you open an image in a TEXT editor.
Did you try my proposals?
That should work!
Best
Klaus
Re: Converting Data From Blob Table For Display
Thanks Klaus!
I imported a generic image to use as the test image.
I can change it to whatever image I wish to display by writing the binary text of the image that I retrieved from the DB to it.
Global ImageHold1
set the text of img "TestImage" to ImageHold1
show image "TestImage"
Regards,
Jorge
I imported a generic image to use as the test image.
I can change it to whatever image I wish to display by writing the binary text of the image that I retrieved from the DB to it.
Global ImageHold1
set the text of img "TestImage" to ImageHold1
show image "TestImage"
Regards,
Jorge