Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display a BLOB image that is taken from database in the imageview?
    primarykey
    data
    text
    <p>I stored the image as BLOB in database and i fetched it using the following coding</p> <pre><code>const char*dbPath=[databasePath UTF8String]; if (sqlite3_open(dbPath, &amp;sqliteHandler)==SQLITE_OK) { sqlite3_stmt *stmt; NSString *selctQuery=[NSString stringWithFormat:@"select * from imagetable where imageId=11"]; NSLog(@"selectQuery is %@",selctQuery); const char *dispStmt=[selctQuery UTF8String]; sqlite3_prepare_v2(sqliteHandler, dispStmt, -1, &amp;stmt, NULL); NSLog(@"%d",sqlite3_prepare_v2(sqliteHandler, dispStmt, -1, &amp;stmt, NULL)); while (sqlite3_step(stmt)==SQLITE_ROW) { // NSString *pwd=[[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(sqltmt, 1)]; // NSString *image1=[[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(stmt, 1)]; // NSString *image2=[[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(stmt, 2)]; // NSString *image3=[[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(stmt, 3)]; //NSLog(@"%@",image1); NSData *cachedImage1 = [[NSData alloc] initWithBytes:sqlite3_column_blob(stmt, 1) length: sqlite3_column_bytes(stmt, 1)]; NSData *cachedImage2 = [[NSData alloc] initWithBytes:sqlite3_column_blob(stmt, 2) length: sqlite3_column_bytes(stmt, 2)]; NSData *cachedImage3 = [[NSData alloc] initWithBytes:sqlite3_column_blob(stmt, 3) length: sqlite3_column_bytes(stmt, 3)]; thumbImage = [UIImage imageWithData:cachedImage1]; bgImage = [UIImage imageWithData:cachedImage2]; logoImage = [UIImage imageWithData:cachedImage3]; [cachedImage1 release]; [cachedImage2 release]; [cachedImage3 release]; } } </code></pre> <p>I tried to display using the following code...</p> <pre><code>bCardFront.image=[UIImage imageNamed:bgImage] </code></pre> <p>but it dispays the warning message that says</p> <blockquote> <p>incompatible Objective-C types 'struct UIImage *', expected 'struct NSString *' when passing argument 1 of 'imageNamed:' from distinct Objective-C type</p> </blockquote> <p>Can anyone please tell me how to display this images in separate imageviews. </p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload