attached 0.4.0 → 0.4.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/README.rdoc CHANGED
@@ -102,11 +102,25 @@ View:
102
102
 
103
103
  # app/models/image.rb
104
104
  has_attached :file, processor: :image, styles: {
105
- small: { size: '200x200<', extension: '.jpg', quality: 90 },
106
- large: { size: '400x400>', extension: '.jpg', quality: 90 },
105
+ small: { size: '200x200>', extension: '.jpg', quality: 90 },
106
+ large: { size: '400x400<', extension: '.jpg', quality: 90 },
107
107
  default: { size: '300x300#', extension: '.jpg', quality: 90 },
108
108
  }
109
109
 
110
+ # app/models/image.rb
111
+ has_attached :file, processor: :image, styles: {
112
+ small: { operation: :decrease, width: 200, height: 200, extension: '.jpg', quality: 90 },
113
+ large: { operation: :increase, width: 400, height: 400, extension: '.jpg', quality: 90 },
114
+ default: { operation: :resize, width: 300, height: 300, extension: '.jpg', quality: 90 },
115
+ }
116
+
117
+ # app/models/audio.rb
118
+ has_attached :file, processor: :audio, styles: {
119
+ full: { preset: '320kbps', extension: '.wav' },
120
+ large: { preset: '256kbps', extension: '.wav' },
121
+ small: { preset: '128kbps', extension: '.wav' },
122
+ }
123
+
110
124
  # app/models/audio.rb
111
125
  has_attached :file, processor: :audio, styles: {
112
126
  full: { preset: '320kbps', extension: '.wav' },
@@ -114,6 +128,15 @@ View:
114
128
  small: { preset: '128kbps', extension: '.wav' },
115
129
  }
116
130
 
131
+ # app/models/audio.rb
132
+ has_attached :file, processor: :audio, styles: {
133
+ full: { preset: 'insane', extension: '.wav' },
134
+ large: { preset: 'extreme', extension: '.wav' },
135
+ small: { preset: 'medium', extension: '.wav' },
136
+ }
137
+
138
+ -preset fast extreme
139
+
117
140
  === Reprocessing
118
141
 
119
142
  rake attached:process[Image,file]
@@ -66,9 +66,7 @@ module Attached
66
66
  raise Errno::ENOENT if $?.exitstatus == 127
67
67
 
68
68
  rescue Errno::ENOENT
69
-
70
69
  raise "command 'lame' not found: ensure LAME is installed"
71
-
72
70
  end
73
71
 
74
72
  unless $?.exitstatus == 0
@@ -37,7 +37,16 @@ module Attached
37
37
  @width ||= options[:width]
38
38
  @height ||= options[:height]
39
39
  @operation ||= options[:operation]
40
-
40
+
41
+ if @operation
42
+ case @operation.intern
43
+ when :decrease then @operation = '>'
44
+ when :increase then @operation = '<'
45
+ when :default then @operation = '#'
46
+ end
47
+ end
48
+
49
+ @operation ||= '#'
41
50
  @extension ||= self.attachment.extension
42
51
 
43
52
  @width = Integer(self.width) if self.width
@@ -1,3 +1,3 @@
1
1
  module Attached
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: attached
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.0
5
+ version: 0.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kevin Sylvestre
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-04 00:00:00 Z
13
+ date: 2011-06-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fog