-
Notifications
You must be signed in to change notification settings - Fork 4
/
LHiPhotoPhoto.m
75 lines (64 loc) · 1.85 KB
/
LHiPhotoPhoto.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// LHiPhotoImage.m
// LastHistory
//
// Created by Frederik Seiffert on 10.11.09.
// Copyright 2009 Frederik Seiffert. All rights reserved.
//
#import "LHiPhotoPhoto.h"
// Example Image:
/*
<key>6153</key>
<dict>
<key>MediaType</key>
<string>Image</string>
<key>Caption</key>
<string>CIMG0818.JPG</string>
<key>Comment</key>
<string>My Comment</string>
<key>GUID</key>
<string>A9CD2B1A-4CA2-4E58-8A0F-DECD422E7B47</string>
<key>Aspect Ratio</key>
<real>0.750000</real>
<key>Rating</key>
<integer>0</integer>
<key>Roll</key>
<integer>6116</integer>
<key>DateAsTimerInterval</key>
<real>175905124.000000</real>
<key>ModDateAsTimerInterval</key>
<real>175937524.000000</real>
<key>MetaModDateAsTimerInterval</key>
<real>176009326.578772</real>
<key>ImagePath</key>
<string>/Users/frederik/Pictures/iPhoto Library/Originals/2006/USA Treffen in München & Erkundungstour/CIMG0818.JPG</string>
<key>ThumbPath</key>
<string>/Users/frederik/Pictures/iPhoto Library/Data/2006/USA Treffen in München & Erkundungstour/CIMG0818.jpg</string>
<key>ImageType</key><string>JPEG</string>
</dict>
*/
@implementation LHiPhotoPhoto
@synthesize roll=_roll;
@synthesize caption=_caption;
@synthesize timestamp=_timestamp;
- (id)initWithDictionary:(NSDictionary *)imageDict inRoll:(LHiPhotoRoll *)roll
{
self = [super init];
if (self != nil) {
_roll = roll;
_caption = [imageDict objectForKey:@"Caption"];
_timestamp = [NSDate dateWithTimeIntervalSinceReferenceDate:[[imageDict objectForKey:@"DateAsTimerInterval"] floatValue]];
_imagePath = [imageDict objectForKey:@"ImagePath"];
_thumbPath = [imageDict objectForKey:@"ThumbPath"];
}
return self;
}
- (NSImage *)image
{
return [[NSImage alloc] initByReferencingFile:_imagePath];
}
- (NSImage *)thumb
{
return [[NSImage alloc] initByReferencingFile:_thumbPath];
}
@end