This code is from Apple WWDC 2011 Session 318 - iOS Performance in Depth and uses CoreGraphics to create thumbnails from images hosted on the server.
CGImageSourceRef src = CGImageSourceCreateWithURL(url);
NSDictionary *options = (CFDictionaryRef)[NSDictionary
dictionaryWithObject:[NSNumber numberWithInt:1024
forKey:(id)kCGImageSourceThumbnailMaxPixelSize];
CGImageRef thumbnail = CGImageSourceCreateThumbnailAtIndex(src,0,options);
UIImage *image = [UIImage imageWithCGImage:thumbnail];
CGImageRelease(thumbnail);
CGImageSourceRelease(src);
But this does not work, and the documents really do not help. In iOS available documentsCGImageSource
CGImageSourceRef
CGImageSourceCreateThumbnailAtIndex
on Mac OS X v10.4 or later
How can I make this work?
EDIT
These are the compiler errors that I get:
- Using undeclared identifier 'CGImageSourceRef'
- Using undeclared identifier 'kCGImageSourceThumbnailMaxPixelSize'
- Using undeclared identifier 'src'
- Implicit function declaration 'CGImageSourceCreateThumbnailAtIndex' invalid in C99
- Implicit function declaration 'CGImageSourceRelease' invalid in C99
- 'CGImageSourceCreateWithURL' C99