summaryrefslogtreecommitdiffstats
path: root/Classes
diff options
context:
space:
mode:
authormatt handler <matt.handler@gmail.com>2011-04-22 14:24:39 -0400
committermatt handler <matt.handler@gmail.com>2011-04-22 14:24:39 -0400
commitc18cefa94f79bb0c1ca8f3b0499f53b6396a2a9c (patch)
tree12d63a9bb31d04aea6198a43ae00c7b4a1214121 /Classes
parent67855bbd4a3ae0e696dedcc9c8541435a97f6a1a (diff)
downloadpiccast-app-c18cefa94f79bb0c1ca8f3b0499f53b6396a2a9c.tar.gz
piccast-app-c18cefa94f79bb0c1ca8f3b0499f53b6396a2a9c.zip
manipulate file and add square cropped to handler, silly way to do it ugh
Diffstat (limited to 'Classes')
-rwxr-xr-xClasses/HJMOHandler.h2
-rwxr-xr-xClasses/HJMOHandler.m17
2 files changed, 19 insertions, 0 deletions
diff --git a/Classes/HJMOHandler.h b/Classes/HJMOHandler.h
index 5e6715d..a103d78 100755
--- a/Classes/HJMOHandler.h
+++ b/Classes/HJMOHandler.h
@@ -24,6 +24,7 @@
enum HJMOState { stateNew, stateLoading, stateLoaded, stateReady, stateFailed } state;
id oid;
BOOL isDataReady;
+ BOOL squareCropped;
NSURL* url;
NSURLConnection* urlConn;
NSMutableData* moData;
@@ -36,6 +37,7 @@
}
@property (readonly) enum HJMOState state;
+@property BOOL squareCropped;
@property (nonatomic, retain) id oid;
@property (nonatomic, retain) NSURL* url;
@property (nonatomic, retain) NSURLConnection* urlConn;
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;