public
Description: A Mac OS X photo uploader program for my photo album.
Homepage: http://bleu.west.spy.net/~dustin/projects/photoupload/
Clone URL: git://github.com/dustin/photoupload.git
Search Repo:
photoupload / PUImage.m
100644 53 lines (43 sloc) 0.891 kb
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
//
// PUImage.m
// PhotoUpload
//
// Created by Dustin Sallings on 2005/29/3.
// Copyright 2005 Dustin Sallings <dustin@spy.net>. All rights reserved.
//
 
#import "PUImage.h"
#import "SizeScaler.h"
 
@implementation PUImage
 
-(id)initWithPath:(NSString *)path
{
  id rv=[super init];
  filename=[path retain];
  
  // Load up the image
  image=[[NSImage alloc] initByReferencingFile: filename];
  [image setName: path];
  [image setScalesWhenResized: YES];
  SizeScaler *sc=[[SizeScaler alloc] initWithSize: [image size]];
  NSSize theSize={64.0, 64.0};
  [image setSize: [sc scaleTo: theSize]];
  [image recache];
  
  return(rv);
}
 
-(void)dealloc
{
  [filename release];
  [image release];
  [super dealloc];
}
 
-(NSString *)filename
{
  return(filename);
}
 
-(NSImage *)image
{
  return(image);
}
 
-(NSString *)description
{
  return([NSString stringWithFormat:@"<PUImage path:%@>", filename]);
}
 
@end