imanip 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.1.1 2008-06-13
2
+
3
+ * 1 minor enhancement:
4
+ * Added rows and columns alias for width and height
5
+
1
6
  == 0.1.0 2008-06-13
2
7
 
3
8
  * 1 major enhancement:
data/README.txt CHANGED
@@ -9,18 +9,18 @@ Super-quick image resizing using the ImageMagick command line tools
9
9
 
10
10
  == FEATURES/PROBLEMS:
11
11
 
12
- - Simple API
13
- - 0% Overhead
14
- - Uses the ImageMagick command line tools (convert, identify)
12
+ - Simple API
13
+ - 0% Overhead
14
+ - Uses the ImageMagick command line tools (convert, identify)
15
15
 
16
- NOTE:
17
- The API is going to be changing a lot as I try to lock down something really useful. As a quick git-er-done type doodad
18
- it works really well, and I'm already using it on some very high volume production sites.
16
+ NOTE:
17
+ The API is going to be changing a lot as I try to lock down something really useful. As a quick git-er-done type doodad
18
+ it works really well, and I'm already using it on some very high volume production sites.
19
19
 
20
20
  == SYNOPSIS:
21
21
 
22
22
 
23
- First things, first, Tell me where you keep them:
23
+ First things, first, Tell me where you keep them:
24
24
 
25
25
 
26
26
  # Rails: production|development|etc.rb
@@ -29,70 +29,74 @@ Super-quick image resizing using the ImageMagick command line tools
29
29
  Imanip::Interface::Magick.execute_path = '/path/to/your/bins/' # eg /usr/local/bin/
30
30
 
31
31
 
32
- With an image file at /dir/image.jpg
32
+ With an image file at /dir/image.jpg
33
33
 
34
34
  image = Imanip::Image.new('/dir/image.jpg')
35
35
 
36
- This will run identify on the image and make sure its convert-able. If it cant read or interpret it it will raise an Imanip::NotAnImageError.
37
- Once you have the image you can check some properties/attributes
36
+ This will run identify on the image and make sure its convert-able. If it cant read or interpret it it will raise an Imanip::NotAnImageError.
37
+
38
+ Once you have the image you can check some properties/attributes
38
39
 
39
40
  image.width #=> 410 (Fixnum)
40
41
  image.height #=> 100 (Fixnum)
41
42
  image.format #=> JPEG (String)
42
43
 
43
- There are also some helpers to do some rule based cropping.
44
+ There are also some helpers to do some rule based cropping.
44
45
 
45
46
  image.portrait? #=> false
46
47
  image.landscape? #=> true
47
48
  image.orientation #=> :landscape
48
49
 
49
- After that you can resize and whatever
50
+ After that you can resize and whatever
50
51
 
51
52
  image.resize('outputfile.jpg', :dimensions => [200,100])
52
53
 
53
- I like crop_resize better. It crops AND resizes so you get an image of the exact pixel dimensions you desire.
54
+ I like crop_resize better. It crops AND resizes so you get an image of the exact pixel dimensions you desire.
54
55
 
55
56
  image.crop_resize('/file/to/output.jpg', :width => 50, :height => 50) #=> output file is an exact 50x50 image
56
57
 
57
- You might also want to catch errors, because they will inevitably happen. Possible Errors
58
+ You might also want to catch errors, because they will inevitably happen. Possible Errors
59
+
58
60
  Imanip::Error # the root, the root, the root is on fire
59
61
  Imanip::NotAnImageError # Descends from above, thrown during Imanip#Image.new
60
62
  Imanip::CouldNotConvertError # Also from above, thrown if theres an issue with #resize or #crop_resize (options, etc.)
61
63
 
62
- More examples coming soon.
64
+ More examples coming soon.
63
65
 
64
66
  == REQUIREMENTS:
65
67
 
66
- You need ImageMagick. Really any version will do, but I am developing with ImageMagick 6.3.3.
67
- http://www.imagemagick.org/script/download.php
68
+ You need ImageMagick. Really any version will do, but I am developing with ImageMagick 6.3.3.
69
+
70
+ http://www.imagemagick.org/script/download.php
68
71
 
69
72
 
70
73
  == INSTALL:
71
74
 
72
- First, install ImageMagick:
73
- http://www.imagemagick.org/script/download.php
74
-
75
- Make sure you get the command line tools:
75
+ First, install ImageMagick:
76
+ http://www.imagemagick.org/script/download.php
77
+
78
+ Make sure you get the command line tools:
76
79
 
77
80
  $ which 'convert'
78
81
 
79
- Imanip works as a gem or a plugin for Rails.
82
+ Imanip works as a gem or a plugin for Rails.
80
83
 
81
- As a gem:
84
+ As a gem:
82
85
 
83
86
  $ sudo gem install imanip
84
87
 
85
- In Rails/environment.rb
88
+ In Rails/environment.rb
86
89
  config.gem 'imanip'
87
90
 
88
- Or you can get the latest from github:
89
- $ sudo gem sources -a http://gems.github.com
90
- $ sudo gem install quirkey-imanip
91
-
91
+ Or you can get the ABSOLUTE latest from github:
92
92
 
93
- == LICENSE:
93
+ $ sudo gem install quirkey-imanip -s http://gems.github.com
94
94
 
95
- (The MIT License)
95
+ To install as a plugin (you need git):
96
+
97
+ $ git clone git://github.com/quirkey/imanip.git vendor/plugins/imanip
98
+
99
+ == LICENSE:
96
100
 
97
101
  Copyright (c) 2008 Aaron Quint, Quirkey
98
102
 
@@ -13,6 +13,8 @@ module Imanip
13
13
  @image_path = path
14
14
  identify
15
15
  end
16
+ alias_method :columns, :width
17
+ alias_method :rows, :height
16
18
 
17
19
  def dimensions
18
20
  [width,height]
@@ -2,7 +2,7 @@ module Imanip #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -17,6 +17,10 @@ class ImanipMagickTest < Test::Unit::TestCase
17
17
  end
18
18
  end
19
19
 
20
+ def test_should_return_an_imanip_image
21
+ assert @portrait_image.is_a?(Imanip::Image)
22
+ end
23
+
20
24
  def test_should_return_dimensions_as_array
21
25
  dimensions = @portrait_image.dimensions
22
26
  assert dimensions.is_a?(Array)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imanip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Quint
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-13 00:00:00 -04:00
12
+ date: 2008-06-16 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15