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

  • SEARCH
  • Home
  • 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 8576175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:52:03+00:00 2026-06-11T19:52:03+00:00

In my iPhone app I need to capture a picture and save it in

  • 0

In my iPhone app I need to capture a picture and save it in to the sqlite database.

 NSString *insertQuery = [NSString stringWithFormat:@"INSERT INTO ProfileTable (NAME, MOBILE, EMAIL, ProfilePICTURE) VALUES(?, ?, ?, ?)"];

                  const char *insert = [insertQuery UTF8String];
                  if(sqlite3_prepare_v2(contactsDB, insert, -1, &insertStatement, NULL) != SQLITE_OK) {
                        NSLog(@"Error while creating insert Statement");
                  }
                  else 
                  {
                        sqlite3_bind_text(insertStatement, 1, [name UTF8String], -1, SQLITE_TRANSIENT);
                        sqlite3_bind_text(insertStatement, 2, [mobile UTF8String], -1, SQLITE_TRANSIENT);
                        sqlite3_bind_text(insertStatement, 2, [email UTF8String], -1, SQLITE_TRANSIENT);


                        sqlite3_bind_blob(insertStatement, 4, [profilePic bytes], [contactImage length], NULL);




                  }
            }


// Same Query  for insert statement also

I saved that file in the form of blob type but that cause to occupy huge memory and causes to memory warnings.

So i have an idea that.

I want to save the captured image as a png file for suppose “image1.png” and insert that title “image1.png” as a varchar type and the retrieve that file having that name when we want to display.

any help how to do this

  • 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-11T19:52:04+00:00Added an answer on June 11, 2026 at 7:52 pm

    Get the document directory (or other directory that you might want to store the images):

    /**
     Returns the URL to the application's Documents directory.
     */
    - (NSURL *)applicationDocumentsDirectory
    {
        return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
    }
    

    Store image as png:

    NSURL *documentsDirURL = [self applicationDocumentsDirectory];
    NSURL *fileURL = [documentsDirURL URLByAppendingPathComponent:@"some-image-name.png"];
    NSData* data = UIImagePNGRepresentation(image);
    [data writeToURL:fileURL atomically:YES];
    NSString *filePath = [fileURL path];
    
    // now save your filePath as string to sqlite
    

    Note, you’ll have to fill in details, such as where the appropriate directory is in the filesystem, a naming convention, generating filenames unless they exist already etc.

    EDIT:

    Here’s some help with serial naming of the images. There are a lot of different solutions.

    Create an entry in the NSUserDefaults with the key @"lastImageNumber". When you need a new image name:

    NSInteger imageNumber = [[NSUserDefaults standardUserDefaults] integerForKey:@"lastImageNumber"] + 1;
    NSString *imageName = [NSString stringWithFormat:@"image%05d.png",imageNumber];
    // save the new imageNumber in the `NSUserDefaults`
    [[NSUserDefaults standardUserDefaults] setInteger:imageNum ForKey:@"lastImageNumber"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i use sqlite database on my iphone app and i need to update this
In my iphone app, I need to project 3d scene into the 2D coordinates
In my dictionary IPhone app I need to save an array of strings which
I am integrating Klazuka Kal into my iPhone app and need more space to
I have an iphone app, and I need to capture some data right as
In my iPhone app I need to round an integer to the nearest multiple
I am making my first major iPhone app and need some advice in saving
I'm in the processes of internationalizing an iPhone app - I need to make
I am building an iPhone app that will need to display info primarily in
I want to make a iPhone app but I need to now how you

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.