This content has been marked as final. Show 4 replies
I do this often.
The source of the image is the PHP script and its "GET" variables, if any.
Here is a simple one for generating 'captcha' security images:
<mx:Image id="captcha" source=" http://www......CaptchaSecurityImages.php"
width="100" height="40" rotation="33" top="36" left="54" />
Unfortunately, we are calling a web service using "post" method only, and that web service is only accepting a JSON string as parameters.
I can get the resultEvent.result.toString(), and I can see something beginning with PNG there, but I don't know how to display that. If I convert the string to byteArray via Base64Decoder, it will say
Error: A partial block (3 of 4 bytes) was dropped. Decoded data is probably truncated!
A simple way would be to handle this on your server side (if you can).
Add a PHP like showImage.php or something that is accessible via URL.
This PHP file can directly access the image data or via your web Services get it.
Here is a simple PHP example which gets the image data from a file ..:
* simple jpeg imagefile output
$file_path = $IMAGES_DIR;
$imageFilePath = $file_path."/".$imagefile;
//read jpeg image
$image = file_get_contents($imageFilePath );
Then in Flex code just use
<mx:Image id="imageShow" source=" http://<your host specific accessible URL>showImage.php?imagefile='.$imageRef" ..
or something similar to this ..
Thanks, I figured out a way to do that:
use URLRequest to get the data of the image and use Loader to load the image. I tried HTTPService before but failed, because HTTPService can not handle binary stream well.