I am having trouble converting a BLOB (MySQL) stored image into a Flex Image.
MySQL Query in coldfusion is as follows (club_images.image is the BLOB):
<cffunction name="GetGeneralData" output="false" access="remote" returntype="Query">
<cfquery name="qRead" datasource=#website_database#>
SELECT domain.domain_name, domain.contact_name, domain.contact_number, domain.team_name, domain.gotsoccer, domain.clubwebsite, domain.age_group,
FROM domain, club_images
WHERE domain = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#domainID#" />
Now when it gets into Flex my results come in as follows:
I need to take the Flex returned GetGeneralDataResult.token.result.image and convert it so it can be set as the source for an image component. I was told maybe it needs to be converts into a byte array?
My image in Flex is as follows:
<s:Image source=''GetGeneralDAtaResults.token.result.image" />
Obviously this doesnt work am in turning to you for help. Anything is appreciated! Thanks -Todd
How is the image being stored ? Usually , when I need to store an image in a database , I convert it to a byte array, then convert the bytearray to a base64 string. Then, when I need to use the image on the frontend, I reverse the process, string->bytearray->Loader->bitmapdata->image.
First the file is uploaded to my server
I than read the file using coldfusion as follows:
<cffile action = "readbinary" file = "#imagePath##File.ServerFile#" variable="image_blob">
I then store it into a database as follows:
<cfquery name="AddImages" datasource=#website_database#>
INSERT INTO club_images (image)
<cfqueryparam value="#image_blob#" cfsqltype="cf_sql_blob">
Then I delete the file off the server since it is now stored in a database
<cffile action="delete" file="#imagePath##File.ServerFile#"/>
This is how I get it into the database. Not sure what form coldfusion uses to uploade it to the database but I do know the file does get uploaded as I can see the KB amount on that BLOB table.