2011-08-05 75 views
2

我正在從服務器上下載圖片並將其保存在我的iphone本地,但有時圖片太大。對於ex(2500 * 3200)。我想,以減少大小300 * 500下載到這iphone.how我能做到這一點。請幫我在這.THANKS IN ADVANCE如何在將圖片下載到iphone之前調整圖片尺寸

+(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];   

} 
+1

爲什麼不調整它的服務器並下載調整後的圖像? – Vladimir

回答