Hi, i store my captured image in the database in a BLOB field. On the success-Event of my camera i get the image with e.media. The length of this blob is e.g. 5000. Now I store the data in the database with
var sql = 'UPDATE XXX SET IMAGE = ? WHERE ID = 1' db.execute(sql, emedia);When i reload the data, the length is only e.g. 5
var rs = db.execute('SELECT IMAGE FROM XXX WHERE ID = 1'); var image = rs.fieldByName('IMAGE'); Ti.API.info(image.length);What I'm doing wrong? I want to achieve to store my image in the database and reload it to show it in an imageview. I'm using the latest Titanium SDK.
Someone else may be able to shed more light on why this isn't working, but I'd recommend storing the file on the file system and just storing a pointer to it in the database. I tried storing images in the database over a year ago (v1.5) and never got it to work properly.
It is a bit more overhead to handle CRUD operations but it works great.
Save data as bse64 encodes does the trick
Think you can help? Login to answer this question!