Skip to content

Instantly share code, notes, and snippets.

@primalmotion
Created April 20, 2010 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save primalmotion/372243 to your computer and use it in GitHub Desktop.
Save primalmotion/372243 to your computer and use it in GitHub Desktop.
@implementation TNBase64Image : CPImage
{
CPString baseEncoded64Data @accessors;
}
+ (TNBase64Image)base64ImageWithData:(CPString)someBase64Data
{
var img = [[TNBase64Image alloc] init];
[img setBaseEncoded64Data:someBase64Data];
[img load];
return img;
}
- (void)load
{
if (_loadStatus == CPImageLoadStatusLoading || _loadStatus == CPImageLoadStatusCompleted)
return;
_loadStatus = CPImageLoadStatusLoading;
_image = new Image();
_image.src = @"data:image/png;base64," + baseEncoded64Data;
console.log(_image.src);
[self _imageDidLoad];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment