Flex - Retrieving base64 encoded image from database
I'm developing a flex application that displays a list of images along with some metadata. The images are less than 500kb. They are stored in the database as base64 encoded strings, retrieved using PHP, send over to flex as XML (which creates a fairly large XML output file)
Now my problem is that, while I can display upto 2-3 images easily, anything more than 3 or sometimes 2 images will cause the images to be corrupt. Sometimes the whole app fails. I am guessing this is due to the large size of the generated XML. I know I am开发者_开发知识库 doing something wrong here. I want to know what is the proper method for storing/retrieving a lot of images in a flex application.
Also, is it a better option to save images as files and storing the path to these files in database ?
Why are you 'storing' the images in an xml? Why don't you just send over the url to the images in the xml and let flex retrieve the images?
Also, your xml was probably corrupt because a base64 image has some weird characters which can screw up xml parsing unless you have it wrapped in CDATA.
Instead of passing it via XML, and since you're already on a PHP setup, you could try using AMF-PHP - it'll pass data between your server and app as native objects. Super slick.
http://amfphp.sourceforge.net/
精彩评论