[AC-3063] Android: blob image fetching fails
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | n/a | 
| Status | Closed | 
| Resolution | Invalid | 
| Resolution Date | 2012-03-28T11:02:38.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | n/a | 
| Components | Titanium SDK & CLI | 
| Labels | android, blob, image | 
| Reporter | Jakub Pilimon | 
| Assignee | Mauro Parra-Miranda | 
| Created | 2012-03-25T23:05:03.000+0000 | 
| Updated | 2016-03-08T07:48:06.000+0000 | 
Description
	It's impossible to fetch blob image from database. It fails while trying to convert to string.
More info here: http://developer.appcelerator.com/question/133836/sqlite-and-blobs
Hello Jakub, please encode your image to base64 in order to store it in sqlite: Ti.API.info("Ti.Utils.base64encode(media): " + Ti.Utils.base64encode(media)); so you will be storing text (which sqlite understand pretty well). Then, when need to use the image, just decode it and should work. best, Mauro
Sure, I thought about that but te problem is: what to do if we have prepared database that we have to retrieve images from. It works perfectly on IOS. Moreover, as far as I can remember decoding gave me an exception: Invalid type of argument when doing sth like that: var encode = Ti.Utils.base64encode(myimage); db.execute("INSERT INTO Product_Image (id, product_Id, imageData) VALUES ('69', '66', ?)", encode); var decode = db.execute('SELECT imageData FROM Product_Image WHERE id = 69'); var myimage2 = Ti.Utils.base64decode(decode);
Hello, that used to happen in 1.7. Was fixed in 1.8.x line. Try the encoding in the 1.8.x SDK. Best, Mauro
Hello, As I said in the first post: it's 1.8.2. Anyway, even if it would work, it does not solve the case. It's still unresolved
Invalid issue.