From 332ae2a5b2a2c610f5e9e7671b45118b0e0023a0 Mon Sep 17 00:00:00 2001 From: Evan Schoenberg Date: Fri, 4 Jan 2008 17:48:18 +0000 Subject: [PATCH] The Address Book can feed us giant images; after syncing my iPhone and getting a bunch of full-quality contact pictures, I had about 8 contacts each with a 300 kilobyte NSImage in memory permanently thanks to address book. We never want more than a 96x96 image, so perform this scaling before keeping the image around. git-svn-id: svn://svn.adiumx.com/adium/trunk@22119 1c916fce-81e2-0310-a464-8ca513f45935 --- Source/ESAddressBookIntegrationPlugin.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/ESAddressBookIntegrationPlugin.m b/Source/ESAddressBookIntegrationPlugin.m index 4962a0502..0549c351c 100644 --- a/Source/ESAddressBookIntegrationPlugin.m +++ b/Source/ESAddressBookIntegrationPlugin.m @@ -604,6 +604,11 @@ NSString* serviceIDForJabberUID(NSString *UID); //Apply the image to the appropriate listObject image = (inData ? [[[NSImage alloc] initWithData:inData] autorelease] : nil); + + //Address book can feed us giant images, which we really don't want to keep around + NSSize size = [image size]; + if (size.width > 96 || size.height > 96) + image = [image imageByScalingToSize:NSMakeSize(96, 96)]; [image setDataRetained:YES]; //Get the object from our tracking dictionary -- 2.11.4.GIT