enhance 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,14 +7,39 @@ Enhance!
7
7
 
8
8
  Enhance! is a Rack middleware that resizes your images on-the-fly using ImageMagick.
9
9
 
10
+ gem install enhance
10
11
 
11
12
  Rails
12
13
  -----
13
14
 
15
+ In your Gemfile
16
+
17
+ gem 'enhance', '~> 0.0.8'
18
+
14
19
  In your application.rb file
15
20
 
16
21
  config.middleware.use "Enhance::Enhancer", Rails.root, :routes => [:attachments, :images]
17
22
 
23
+ In your views:
24
+
25
+ image_tag enhance!("/images/toto.jpg", "200x200")
26
+
27
+ Usage
28
+ -----
29
+
30
+ Enhance! will match URIs based on the config parameters. To the normal image URI, you will need to add the format. The format looks like ImageMagick's parameters.
31
+
32
+ Here are a few examples:
33
+
34
+ * 200 or 200x, x200 or 200x200: resizes the image up to 200 pixels wide or high, keeping proportions and never upscaling the image
35
+ * adding "<", ex: 200<: allows upscaling the image
36
+ * 200x200!: disables proportions and resizes the image
37
+ * adding "sample", ex: 200x200sample: resizes the image using nearest-neighbor filter
38
+
39
+ Example of matched URI:
40
+
41
+ http://my_application.com/images/toto.jpg/200x200sample
42
+
18
43
 
19
44
  Config Options
20
45
  --------------
@@ -16,7 +16,8 @@ class Enhance::Enhancer
16
16
  @app = app
17
17
  @extensions = [options[:extensions]].flatten || %w( jpg png jpeg gif )
18
18
  @routes = options[:routes] || %w( images )
19
- @folders = [options[:folders]].flatten || [File.join(root, "public")]
19
+ @folders = [options[:folders]].flatten.compact
20
+ @folders = [File.join(root, "public")] if @folders.blank?
20
21
  @quality = options[:quality] || 100
21
22
  @command_path = options[:convert_path] || "#{Paperclip.options[:command_path] if defined?(Paperclip)}"
22
23
  @command_path += "/" unless @command_path.empty?
@@ -1,3 +1,3 @@
1
1
  module Enhance
2
- VERSION = '0.0.8'
3
- end
2
+ VERSION = '0.0.9'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enhance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-26 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &2160890120 !ruby/object:Gem::Requirement
16
+ requirement: &70355417546340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160890120
24
+ version_requirements: *70355417546340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: utilities
27
- requirement: &2160889660 !ruby/object:Gem::Requirement
27
+ requirement: &70355417545920 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2160889660
35
+ version_requirements: *70355417545920
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack-test
38
- requirement: &2160889180 !ruby/object:Gem::Requirement
38
+ requirement: &70355417536420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2160889180
46
+ version_requirements: *70355417536420
47
47
  description: Middleware to "enhance" and resize images on the fly.
48
48
  email: gmalette@gmail.com
49
49
  executables: []
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 1.8.6
82
+ rubygems_version: 1.8.10
83
83
  signing_key:
84
84
  specification_version: 3
85
85
  summary: Image resizing on the fly