I'm trying to display an image i got from a bytearray returned by an AMFPHP RPC call, This bytearray was saved into a MYSQL database BLOB field. here is a snippet of my PHP code
$db=new DBHandler(); $imageData=addslashes($image->data); $sql="INSERT INTO profile (profile_id,image) VALUES('$profile_id','$imageData')"; return $db->update($sql);
The addslash() function just escapes chraccter that would mess up my sql statement.
When i make a call to retrieve this record from my flex application. it doesnt display anything when i try to read bytearray. I assigned the byterray directly to source property of the image control. Do i need to do anything to bytearray i recieved. Did the addslash() function mess up the binary data?.
Yup... the byte array should be sent as is from the server to the client. And assign the byte array to the source property of the image. That should work Ok without much pain. You might have to come up with a work around on this one on the server side if you cannot save to the DB without slashing it.
Byte array should not be saved in the dababase,instead it should be saved as a image in the file system and its path in terms of url
should be return to you so that you will pass that to the image.
Also you can check the link as:-
Hope this will work for you.