From: Michael J. Rubinsky Date: Thu, 6 Aug 2009 14:12:54 +0000 (-0400) Subject: Properly ask NSImage for an NSImageRef that is appropriately sized X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=bd46402a18f50a5f6b13d6e36a685f8342b59419;p=horde.git Properly ask NSImage for an NSImageRef that is appropriately sized for a screen resolution and let the NSImageView object worry about scaling it. Fixes the annoying problem of the gallery key images being really really tiny. --- diff --git a/iPhoto2Ansel/AnselExportController.m b/iPhoto2Ansel/AnselExportController.m index 591a819d7..cc9db658f 100644 --- a/iPhoto2Ansel/AnselExportController.m +++ b/iPhoto2Ansel/AnselExportController.m @@ -713,9 +713,17 @@ NSString * const TURAnselServerPasswordKey = @"password"; currentGallery = [[anselController getGalleryByIndex:row] retain]; [currentGallery setDelegate: self]; - // TODO: Figure out why these don't always properly size. + // Obtain and properly size the image for screen NSImage *theImage = [[NSImage alloc] initWithContentsOfURL: [currentGallery galleryDefaultImageURL]]; + NSSize imageSize; + imageSize.width = [[theImage bestRepresentationForDevice:nil] pixelsWide]; + imageSize.height = [[theImage bestRepresentationForDevice:nil] pixelsHigh]; + [theImage setScalesWhenResized:YES]; + [theImage setSize:imageSize]; + + // Show it [defaultImageView setImage: theImage]; + [theImage release]; [self canExport]; [viewGallery setEnabled: YES];