How to Resize image before downloading it to iphone
<p>I am downloading images from server and saving them locally in my iphone,But sometimes the image is too large.for ex (2500*3200). i want to reduce the size to 300*500 before downloading that into iphone.how can i do this  .Please help me in this .THANKS IN ADVANCE</p>

<pre><code>+(void)DownloadImage:(NSString*)ImagePath{

    if ([ImagePath isEqualToString:@""])
        return;

    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[IMAGEURL stringByAppendingPathComponent:ImagePath]]];

    NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    [data writeToFile:[docDir stringByAppendingPathComponent:ImagePath] atomically:YES];        

}
</code></pre>
