Created
February 27, 2016 23:09
-
-
Save ymoussaba/83e90d95085d37ed4275 to your computer and use it in GitHub Desktop.
Revisions
-
Vadim Shpakovski revised this gist
Feb 5, 2012 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,10 +8,10 @@ - (CGSize)sizeOfImageAtURL:(NSURL *)imageURL CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)imageURL, NULL); if (source) { NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCGImageSourceShouldCache]; CFDictionaryRef properties = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, 0, (CFDictionaryRef)options); if (properties) { NSNumber *width = [(NSDictionary *)properties objectForKey:(NSString *)kCGImagePropertyPixelWidth]; NSNumber *height = [(NSDictionary *)properties objectForKey:(NSString *)kCGImagePropertyPixelHeight]; if ((width != nil) && (height != nil)) imageSize = CGSizeMake(width.floatValue, height.floatValue); CFRelease(properties); -
Vadim Shpakovski revised this gist
Feb 5, 2012 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ // This method requires ImageIO.framework #import <ImageIO/ImageIO.h> - (CGSize)sizeOfImageAtURL:(NSURL *)imageURL { // With CGImageSource we avoid loading the whole image into memory -
Vadim Shpakovski renamed this gist
Feb 5, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Vadim Shpakovski revised this gist
Feb 5, 2012 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,9 +9,8 @@ if (properties) { NSNumber *width = [properties objectForKey:(NSString *)kCGImagePropertyPixelWidth]; NSNumber *height = [properties objectForKey:(NSString *)kCGImagePropertyPixelHeight]; if ((width != nil) && (height != nil)) imageSize = CGSizeMake(width.floatValue, height.floatValue); CFRelease(properties); } CFRelease(source); -
Vadim Shpakovski created this gist
Feb 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ - (CGSize)sizeOfImageAtURL:(NSURL *)imageURL { // With CGImageSource we avoid loading the whole image into memory CGSize imageSize = CGSizeZero; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)imageURL, NULL); if (source) { NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCGImageSourceShouldCache]; NSDictionary *properties = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, 0, (CFDictionaryRef)options); if (properties) { NSNumber *width = [properties objectForKey:(NSString *)kCGImagePropertyPixelWidth]; NSNumber *height = [properties objectForKey:(NSString *)kCGImagePropertyPixelHeight]; if ((width != nil) && (height != nil)) { imageSize = CGSizeMake(width.floatValue, height.floatValue); } CFRelease(properties); } CFRelease(source); } return imageSize; }