From c18cefa94f79bb0c1ca8f3b0499f53b6396a2a9c Mon Sep 17 00:00:00 2001 From: matt handler Date: Fri, 22 Apr 2011 14:24:39 -0400 Subject: manipulate file and add square cropped to handler, silly way to do it ugh --- Classes/HJMOHandler.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Classes/HJMOHandler.m') diff --git a/Classes/HJMOHandler.m b/Classes/HJMOHandler.m index fb8643e..ab95766 100755 --- a/Classes/HJMOHandler.m +++ b/Classes/HJMOHandler.m @@ -11,11 +11,13 @@ #import "HJMOUser.h" #import "HJObjManager.h" #import "HJMOFileCache.h" +#import "HJManagedImageV.h" @implementation HJMOHandler @synthesize state; +@synthesize squareCropped; @synthesize oid; @synthesize url; @synthesize urlConn; @@ -341,6 +343,21 @@ [moLoadingDataFile closeFile]; self.moLoadingDataFile = nil; self.urlConn = nil; + + // manipulate file here + if ([users count] > 0) { + HJManagedImageV *user = [users objectAtIndex:0]; + if (self.squareCropped) { + NSLog(@"here"); + HJMOFileCache* fileCache = objManager.fileCache; + NSString* loadingFile = [[fileCache loadingFilePathForOid:oid] retain]; + UIImage *cropped = [[[UIImage imageWithContentsOfFile:loadingFile] imageByScalingAndCroppingForSize:CGSizeMake(100,100)] retain]; + //[[[UIImageView alloc] initWithImage:[moHandler.moData imageByScalingAndCroppingForSize:CGSizeMake(100,100)]] autorelease]; + [UIImagePNGRepresentation(cropped) writeToFile:loadingFile atomically:YES]; + NSLog(@"after"); + } + } + NSString* readyFilename = [self.objManager.fileCache loadingFinishedForOid:oid]; if (readyFilename==nil) { state = stateFailed; -- cgit v1.2.3