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 8148083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:34:38+00:00 2026-06-06T14:34:38+00:00

I’m writing an application that gives the user the option to resize an image

  • 0

I’m writing an application that gives the user the option to resize an image that they take and upload it to a service. The resizing seems to work fine, but it’s not storing the re-created image in the proper place, because the application doesn’t seem to think that there’s a photo loaded.

Note that the first function in the if statement (regarding “normal_size”) works fine. I’ve tried to re-create those two lines in the additional size parameters, but I can’t seem to figure out why it’s not storing it. This is driving me crazy. Here’s the code:

// Set image dictionaries
iInfoDict = [[NSDictionary alloc] initWithDictionary:info];
NSLog(@"infor ===== %@", info);
UIImage* image =[info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSLog(@"iImage name === %@", iImage);

// Determines path of image taken / chosen
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *appFile = [documentsDirectory stringByAppendingPathComponent:@"image.jpg"];

CGSize size;

// Not sure what this does other than dismissing the pickerViewController

NSData* data = UIImageJPEGRepresentation(image, 0.9);
[data writeToFile:appFile options:nil error:nil];
NSLog(@"Documents ==== %@", documentsDirectory);
[picker dismissModalViewControllerAnimated:YES];
//    photo.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; 

// IMAGE RESIZE CODE

if ([[NSUserDefaults standardUserDefaults] boolForKey:@"normal_image"])    
{
    [photoData setObject:[iInfoDict objectForKey:@"UIImagePickerControllerOriginalImage"] forKey:@"image"];
     photo.image = [iInfoDict objectForKey:@"UIImagePickerControllerOriginalImage"];
}
else if ([[NSUserDefaults standardUserDefaults] boolForKey:@"small_image"])
{
    CGSize size = CGSizeMake (600, 450);
    UIImage *origImage = [iInfoDict objectForKey:@"UIImagePickerControllerOriginalImage"];
    UIImage *destImage = [origImage resizedImage:size interpolationQuality:kCGInterpolationHigh];

    NSLog(@"Image Size: %@", NSStringFromCGSize(destImage.size));
    [photoData setObject:destImage forKey:@"image"];

    photo.image = destImage;
}
  • 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-06T14:34:39+00:00Added an answer on June 6, 2026 at 2:34 pm

    Either I’m not understanding your question, or you don’t understand what you’re doing. I suspect the latter, based on the comment // Not sure what this does other than dismissing the pickerViewController, which is promptly followed by two lines that write the unresized image to the documents directory.

    You probably want to resize the image before you write it out, so I suggest moving the writing to the end, after you’ve resized.

    Delete the two lines:

    NSData* data = UIImageJPEGRepresentation(image, 0.9);
    [data writeToFile:appFile options:nil error:nil];
    

    And, at the end, insert these two lines (no guarantee, written from memory):

    NSData* data = UIImageJPEGRepresentation(photo.image, 0.9);
    [data writeToFile:appFile options:nil error:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I know there's a lot of other questions out there that deal with this
I need a function that will clean a strings' special characters. I do NOT

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.