Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8757977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:25:55+00:00 2026-06-13T14:25:55+00:00

I am developing an app for iOS that uses SQLite3 database now i want

  • 0

I am developing an app for iOS that uses SQLite3 database now i want to save some images in it, i have searched on net that people tells that it is not good idea to save images in SQLite3 like this one

Blob Data Type?

I am totally confuse that what to do so i am painting my whole situation in front of you please advice me what to do

i want to store 79 images in my SQLite database most of them are 2kb in size and very few are 20 to 25 kb totally all the images takes 384kb on disk so is it advisable to store all the images in my database or only use links in my database and filesystem for images

Please advise me as soon as possible

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:25:56+00:00Added an answer on June 13, 2026 at 2:25 pm

    In my opinion Save imagePath in SQLite, and save image in your document directory. I do the same. May be this help you.

    -(void)saveDataToDatabase:(NSString *)fileNameToSave
    {
    
    NSString *docsDir;
    NSArray *dirPaths;
    dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    
    docsDir = [dirPaths objectAtIndex:0];
    sqlite3_stmt    *statement;
    NSString *databasePath = [[NSString alloc]
                              initWithString: [docsDir stringByAppendingPathComponent:
                                               @"scanner.db"]];
    
    NSLog(@"%@",databasePath);
    
    const char *dbpath = [databasePath UTF8String];
    
    if (sqlite3_open(dbpath, &databaseHandle) == SQLITE_OK)
    {
        NSString *insertSQL = [NSString stringWithFormat: @"Insert into IMAGEINFO (NAME,IMAGEPATH) values ('%@','%@')",@"imageFirst",fileNameToSave];
        const char *insert_stmt = [insertSQL UTF8String];
        sqlite3_prepare_v2(databaseHandle, insert_stmt, -1, &statement, NULL);
        if (sqlite3_step(statement) == SQLITE_DONE)
        {
            [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"database"];
        }
        else
        {
        }
    }
    
    }
    
    
    -(void)saveImage:(NSString *)fileName:(UIImage *)imageToSave
    {
    NSError *error;
    NSString *fileNaToSave = [NSString stringWithFormat:@"Documents/%@.png",fileName];
    NSString  *pngPath = [NSHomeDirectory() stringByAppendingPathComponent:fileNaToSave];
    
    // Write image to PNG
    [UIImagePNGRepresentation(imageToSave) writeToFile:pngPath atomically:YES];
    // Let's check to see if files were successfully written...
    // You can try this when debugging on-device
    
    // Create file manager
    NSFileManager *fileMgr = [NSFileManager defaultManager];
    
    // Point to Document directory
    NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
    
    // Write out the contents of home directory to console
    NSLog(@"Documents directory: %@", [fileMgr contentsOfDirectoryAtPath:documentsDirectory error:&error]);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm now developing an app on iOS. With some reason, I want to use
I'm developing web-application (and also native iOS app) that uses images from different websites.
I am developing an ios app that uses Dropbox SDK. I want to notify
I'm developing an iOS app that I want it to have more than 10
I'm developing an app that uses iOS4 features (like MFMessageComposeViewController), but I want to
I'm developing a web app for iOS devices, and want to have a header
We developing a iOS app that uses CoreData. To keep ourselves from going crazy
I am developing an app that uses Core Data. In iOS 5, I don't
I'm developing an ios app that's very basic and uses objective almost all of
I'm in the process of developing an iOS app that retrieves images from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.