tags:

views:

55

answers:

1

Hello friends..

I am new to iphone so please help me to solved my problem... Actually , Storing and Fetching "Images" with text data from database(Sqlite-3)CRASH the application..!! i am using these data in search table.. after fetching all the data,application crash after 2-3 min. ->Let me know the whats the best way to store or fetch the image data ? ->or I should store the image after reducing the size , if it then how to reduce the size n store the data currently I am using BLOB.

waiting for quick reply Thanks...

A: 

Why are you stroing the images as text or data. If they can be stored directly into database using

NSData *imgData = UIImagePNGRepresentation(your.image);

sqlite3_bind_blob(insertStmt, 0, [imgData bytes], [imgData length], NULL);

and when you want to get them you can do this as..

NSData *data = [[NSData alloc] initWithBytes:sqlite3_column_blob(selectStmt, 0) length:sqlite3_column_bytes(selectStmt, 0)];

UIImage *urImg = [UIImage imageWithData:data];

If you want to get into details you can get it here

Hope this helps.

Madhup