Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3063] Android: blob image fetching fails

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2012-03-28T11:02:38.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, blob, image
ReporterJakub Pilimon
AssigneeMauro Parra-Miranda
Created2012-03-25T23:05:03.000+0000
Updated2016-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

Comments

  1. Mauro Parra-Miranda 2012-03-26

    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
  2. Jakub Pilimon 2012-03-27

    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);
  3. Mauro Parra-Miranda 2012-03-28

    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
  4. Jakub Pilimon 2012-03-28

    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
  5. Mauro Parra-Miranda 2013-11-24

    Invalid issue.

JSON Source