dragonfly 0.7.7 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of dragonfly might be problematic. Click here for more details.
- data/Gemfile +1 -1
- data/Gemfile.rails.2.3.5 +0 -1
- data/History.md +12 -0
- data/README.md +4 -2
- data/VERSION +1 -1
- data/config.ru +1 -1
- data/dragonfly.gemspec +256 -179
- data/extra_docs/Analysers.md +15 -6
- data/extra_docs/Configuration.md +13 -2
- data/extra_docs/Encoding.md +20 -7
- data/extra_docs/GeneralUsage.md +8 -5
- data/extra_docs/Generators.md +17 -7
- data/extra_docs/Heroku.md +1 -2
- data/extra_docs/MimeTypes.md +1 -1
- data/extra_docs/Models.md +1 -1
- data/extra_docs/Mongo.md +2 -2
- data/extra_docs/Processing.md +15 -7
- data/extra_docs/Rack.md +2 -3
- data/extra_docs/Rails2.md +2 -3
- data/extra_docs/Rails3.md +2 -3
- data/extra_docs/Sinatra.md +2 -2
- data/extra_docs/URLs.md +6 -4
- data/features/3.0.3.feature +8 -0
- data/features/steps/rails_steps.rb +2 -2
- data/features/support/env.rb +1 -1
- data/fixtures/files/app/views/albums/new.html.erb +4 -4
- data/fixtures/rails_2.3.5/template.rb +0 -1
- data/fixtures/{rails_3.0.0 → rails_3.0.3}/template.rb +0 -1
- data/irbrc.rb +1 -1
- data/lib/dragonfly/analysis/image_magick_analyser.rb +47 -0
- data/lib/dragonfly/app.rb +2 -0
- data/lib/dragonfly/config/image_magick.rb +41 -0
- data/lib/dragonfly/data_storage/file_data_store.rb +4 -2
- data/lib/dragonfly/data_storage/s3data_store.rb +7 -3
- data/lib/dragonfly/encoding/image_magick_encoder.rb +57 -0
- data/lib/dragonfly/generation/hash_with_css_style_keys.rb +23 -0
- data/lib/dragonfly/generation/image_magick_generator.rb +140 -0
- data/lib/dragonfly/generation/r_magick_generator.rb +0 -18
- data/lib/dragonfly/image_magick_utils.rb +81 -0
- data/lib/dragonfly/processing/image_magick_processor.rb +99 -0
- data/lib/dragonfly/rails/images.rb +1 -1
- data/lib/dragonfly/temp_object.rb +7 -6
- data/spec/dragonfly/analysis/image_magick_analyser_spec.rb +15 -0
- data/spec/dragonfly/analysis/r_magick_analyser_spec.rb +5 -49
- data/spec/dragonfly/analysis/shared_analyser_spec.rb +51 -0
- data/spec/dragonfly/app_spec.rb +2 -0
- data/spec/dragonfly/data_storage/data_store_spec.rb +6 -0
- data/spec/dragonfly/data_storage/file_data_store_spec.rb +1 -1
- data/spec/dragonfly/data_storage/s3_data_store_spec.rb +11 -1
- data/spec/dragonfly/deprecation_spec.rb +2 -2
- data/spec/dragonfly/encoding/image_magick_encoder_spec.rb +41 -0
- data/spec/dragonfly/encoding/r_magick_encoder_spec.rb +3 -6
- data/spec/dragonfly/generation/hash_with_css_style_keys_spec.rb +24 -0
- data/spec/dragonfly/generation/image_magick_generator_spec.rb +12 -0
- data/spec/dragonfly/generation/r_magick_generator_spec.rb +12 -123
- data/spec/dragonfly/generation/shared_generator_spec.rb +91 -0
- data/spec/dragonfly/image_magick_utils_spec.rb +16 -0
- data/spec/dragonfly/processing/image_magick_processor_spec.rb +29 -0
- data/spec/dragonfly/processing/r_magick_processor_spec.rb +2 -212
- data/spec/dragonfly/processing/shared_processing_spec.rb +215 -0
- data/spec/image_matchers.rb +6 -0
- data/spec/spec_helper.rb +11 -0
- data/yard/templates/default/fulldoc/html/css/common.css +9 -2
- data/yard/templates/default/layout/html/layout.erb +12 -1
- metadata +310 -11
- data/.gitignore +0 -15
- data/features/rails_3.0.0.feature +0 -8
data/extra_docs/Analysers.md
CHANGED
@@ -19,14 +19,14 @@ and an image object (actually a {Dragonfly::Job Job} object)...
|
|
19
19
|
|
20
20
|
We can analyse it using any analysis methods that have been registered with the analyser.
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
The {Dragonfly::Analysis::
|
25
|
-
{Dragonfly::Config::
|
22
|
+
ImageMagickAnalyser
|
23
|
+
-------------------
|
24
|
+
The {Dragonfly::Analysis::ImageMagickAnalyser ImageMagickAnalyser} is registered by default by the
|
25
|
+
{Dragonfly::Config::ImageMagick ImageMagick configuration} used by 'dragonfly/rails/images'.
|
26
26
|
|
27
27
|
If not already registered:
|
28
28
|
|
29
|
-
app.analyser.register(Dragonfly::Analysis::
|
29
|
+
app.analyser.register(Dragonfly::Analysis::ImageMagickAnalyser)
|
30
30
|
|
31
31
|
gives us these methods:
|
32
32
|
|
@@ -39,6 +39,15 @@ gives us these methods:
|
|
39
39
|
image.number_of_colours # => 34703
|
40
40
|
image.format # => :png
|
41
41
|
|
42
|
+
RMagickAnalyser
|
43
|
+
-------------------
|
44
|
+
The {Dragonfly::Analysis::RMagickAnalyser RMagickAnalyser} uses the {http://rmagick.rubyforge.org RMagick} library and provides methods `width`, `height`, `aspect_ratio`,
|
45
|
+
`portrait?`, `landscape?`, `depth`, `number_of_colours` and `format` like the ImageMagickAnalyser.
|
46
|
+
|
47
|
+
You can tell it not to use the file system when registering it
|
48
|
+
|
49
|
+
app.analyser.register(Dragonfly::Analysis::RMagickAnalyser){|a| a.use_filesystem = false }
|
50
|
+
|
42
51
|
FileCommandAnalyser
|
43
52
|
-------------------
|
44
53
|
The {Dragonfly::Analysis::FileCommandAnalyser FileCommandAnalyser} is registered by default by the
|
@@ -72,7 +81,7 @@ To register a single custom analyser:
|
|
72
81
|
|
73
82
|
image.wobbliness # => 71
|
74
83
|
|
75
|
-
You can create a class like the
|
84
|
+
You can create a class like the ImageMagick one above, in which case all public methods will be counted as analysis methods.
|
76
85
|
Each method takes the temp_object as its argument.
|
77
86
|
|
78
87
|
class MyAnalyser
|
data/extra_docs/Configuration.md
CHANGED
@@ -65,6 +65,19 @@ Saved configurations
|
|
65
65
|
Saved configurations are useful if you often configure the app the same way.
|
66
66
|
There are a number that are provided with Dragonfly:
|
67
67
|
|
68
|
+
ImageMagick
|
69
|
+
-----------
|
70
|
+
|
71
|
+
app.configure_with(:imagemagick)
|
72
|
+
|
73
|
+
The {Dragonfly::Config::ImageMagick ImageMagick configuration} registers the app with the {Dragonfly::Analysis::ImageMagickAnalyser ImageMagickAnalyser}, {Dragonfly::Processing::ImageMagickProcessor ImageMagickProcessor},
|
74
|
+
{Dragonfly::Encoding::ImageMagickEncoder ImageMagickEncoder} and {Dragonfly::Generation::ImageMagickGenerator ImageMagickGenerator}, and adds the 'job shortcuts'
|
75
|
+
`thumb`, `jpg`, `png`, `gif` and `convert`.
|
76
|
+
|
77
|
+
The file 'dragonfly/rails/images' does this for you.
|
78
|
+
|
79
|
+
The processor, analyser, encoder and generator pass data around using tempfiles.
|
80
|
+
|
68
81
|
RMagick
|
69
82
|
-------
|
70
83
|
|
@@ -74,8 +87,6 @@ The {Dragonfly::Config::RMagick RMagick configuration} registers the app with th
|
|
74
87
|
{Dragonfly::Encoding::RMagickEncoder RMagickEncoder} and {Dragonfly::Generation::RMagickGenerator RMagickGenerator}, and adds the 'job shortcuts'
|
75
88
|
`thumb`, `jpg`, `png` and `gif`.
|
76
89
|
|
77
|
-
The file 'dragonfly/rails/images' does this for you.
|
78
|
-
|
79
90
|
By default the processor, analyser, encoder and generator pass data around using tempfiles.
|
80
91
|
You can make it pass data around using in-memory strings using
|
81
92
|
|
data/extra_docs/Encoding.md
CHANGED
@@ -20,14 +20,14 @@ and an image object (actually a {Dragonfly::Job Job} object)...
|
|
20
20
|
|
21
21
|
We can encode it to any format registered with the encoder.
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
The {Dragonfly::Encoding::
|
26
|
-
the {Dragonfly::Config::
|
23
|
+
ImageMagickEncoder
|
24
|
+
------------------
|
25
|
+
The {Dragonfly::Encoding::ImageMagickEncoder ImageMagickEncoder} is registered by default by
|
26
|
+
the {Dragonfly::Config::ImageMagick ImageMagick configuration} used by 'dragonfly/rails/images'.
|
27
27
|
|
28
28
|
If not already registered:
|
29
29
|
|
30
|
-
app.encoder.register(Dragonfly::Encoding::
|
30
|
+
app.encoder.register(Dragonfly::Encoding::ImageMagickEncoder)
|
31
31
|
|
32
32
|
gives us:
|
33
33
|
|
@@ -36,7 +36,20 @@ gives us:
|
|
36
36
|
image.encode(:png)
|
37
37
|
image.encode(:tiff)
|
38
38
|
|
39
|
-
and various other formats (see {Dragonfly::Encoding::
|
39
|
+
and various other formats (see {Dragonfly::Encoding::ImageMagickEncoder ImageMagickEncoder}).
|
40
|
+
|
41
|
+
You can also pass additional options to the imagemagick command line:
|
42
|
+
|
43
|
+
image.encode(:jpg, '-quality 10')
|
44
|
+
|
45
|
+
RMagickEncoder
|
46
|
+
--------------
|
47
|
+
The {Dragonfly::Encoding::RMagickEncoder RMagickEncoder} uses the {http://rmagick.rubyforge.org RMagick} library to do similar things to the
|
48
|
+
ImageMagickEncoder above.
|
49
|
+
|
50
|
+
You can tell it not to use the file system when registering it using
|
51
|
+
|
52
|
+
app.encoder.register(Dragonfly::Encoding::RMagickEncoder){|e| e.use_filesystem = false }
|
40
53
|
|
41
54
|
Lazy evaluation
|
42
55
|
---------------
|
@@ -68,7 +81,7 @@ To register a custom encoder, for e.g. pdf format:
|
|
68
81
|
|
69
82
|
If `:unable_to_handle` is thrown, the next most recently registered encoder is used, and so on.
|
70
83
|
|
71
|
-
Alternatively you can create a class like the
|
84
|
+
Alternatively you can create a class like the ImageMagick one above, which implements the method `encode`, and register this.
|
72
85
|
|
73
86
|
class MyEncoder
|
74
87
|
|
data/extra_docs/GeneralUsage.md
CHANGED
@@ -110,9 +110,12 @@ To define this shortcut:
|
|
110
110
|
# ...
|
111
111
|
end
|
112
112
|
|
113
|
-
The {Dragonfly::Config::
|
113
|
+
The {Dragonfly::Config::ImageMagick ImageMagick} configuration comes with the pre-defined shortcuts:
|
114
114
|
|
115
|
-
image.thumb('40x30')
|
116
|
-
image.jpg
|
117
|
-
image.png
|
118
|
-
image.gif
|
115
|
+
image.thumb('40x30') # same as image.process(:thumb, '40x30')
|
116
|
+
image.jpg # same as image.encode(:jpg)
|
117
|
+
image.png # same as image.encode(:png)
|
118
|
+
image.gif # same as image.encode(:gif)
|
119
|
+
image.convert('-scale 30x30') # same as image.process(:convert, '-scale 30x30')
|
120
|
+
|
121
|
+
`thumb` and `convert` can optionally take a format (e.g. :gif) as the second argument.
|
data/extra_docs/Generators.md
CHANGED
@@ -15,14 +15,14 @@ we can get generated content using
|
|
15
15
|
|
16
16
|
where `:some_method` is added by the configured generators.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
The {Dragonfly::Generation::
|
21
|
-
{Dragonfly::Config::
|
18
|
+
ImageMagickGenerator
|
19
|
+
--------------------
|
20
|
+
The {Dragonfly::Generation::ImageMagickGenerator ImageMagickGenerator} is registered by default by the
|
21
|
+
{Dragonfly::Config::ImageMagick ImageMagick configuration} used by 'dragonfly/rails/images'.
|
22
22
|
|
23
23
|
If not already registered:
|
24
24
|
|
25
|
-
app.generator.register(Dragonfly::Generation::
|
25
|
+
app.generator.register(Dragonfly::Generation::ImageMagickGenerator)
|
26
26
|
|
27
27
|
gives us these methods:
|
28
28
|
|
@@ -48,9 +48,19 @@ Note that the options are meant to resemble css as much as possible. You can als
|
|
48
48
|
|
49
49
|
You can use `padding-top`, `padding-left`, etc., as well as the standard css shortcuts for `padding` (it assumes unit is px).
|
50
50
|
|
51
|
-
An alternative for `:font_family` is `:font` (see {http://www.imagemagick.org/
|
51
|
+
An alternative for `:font_family` is `:font` (see {http://www.imagemagick.org/script/command-line-options.php#font}), which could be a complete filename.
|
52
52
|
Available fonts are those available on your system.
|
53
53
|
|
54
|
+
RMagickGenerator
|
55
|
+
----------------
|
56
|
+
The {Dragonfly::Generation::RMagickGenerator RMagickGenerator} gives you `plasma` and `text` like the imagemagick generator above, using the
|
57
|
+
{http://rmagick.rubyforge.org RMagick} library.
|
58
|
+
|
59
|
+
You can tell it not to use the file system when registering it
|
60
|
+
|
61
|
+
app.generator.register(Dragonfly::Generation::RMagickGenerator){|g| g.use_filesystem = false }
|
62
|
+
|
63
|
+
|
54
64
|
Custom Generators
|
55
65
|
-----------------
|
56
66
|
To register a single custom generator:
|
@@ -62,7 +72,7 @@ To register a single custom generator:
|
|
62
72
|
app.generate(:blank_image, 'red') # => 'Job' object which we can get data, etc.
|
63
73
|
|
64
74
|
|
65
|
-
Or create a class like the
|
75
|
+
Or create a class like the ImageMagick one above, in which case all public methods will be counted as generator methods.
|
66
76
|
|
67
77
|
class RoundedCornerGenerator
|
68
78
|
|
data/extra_docs/Heroku.md
CHANGED
@@ -12,7 +12,6 @@ Assuming you have an S3 account set up...
|
|
12
12
|
|
13
13
|
Gem dependencies:
|
14
14
|
|
15
|
-
- rmagick (require as 'RMagick')
|
16
15
|
- aws-s3 (require as aws/s3)
|
17
16
|
- dragonfly
|
18
17
|
|
@@ -21,7 +20,7 @@ Initializer (e.g. config/initializers/dragonfly.rb):
|
|
21
20
|
require 'dragonfly'
|
22
21
|
app = Dragonfly[:images]
|
23
22
|
|
24
|
-
app.configure_with(:
|
23
|
+
app.configure_with(:imagemagick)
|
25
24
|
app.configure_with(:rails)
|
26
25
|
app.configure_with(:heroku, 'my_bucket_name') if Rails.env.production?
|
27
26
|
|
data/extra_docs/MimeTypes.md
CHANGED
@@ -27,7 +27,7 @@ You can also do this inside a configuration block.
|
|
27
27
|
Analysers
|
28
28
|
---------
|
29
29
|
The {Dragonfly::Analysis::FileCommandAnalyser FileCommandAnalyser} has a `mime_type` method and the
|
30
|
-
{Dragonfly::Analysis::
|
30
|
+
{Dragonfly::Analysis::ImageMagickAnalyser ImageMagickAnalyser} has a `format` method.
|
31
31
|
|
32
32
|
These are both registered by default when you use the preconfigured 'dragonfly/rails/images' file.
|
33
33
|
|
data/extra_docs/Models.md
CHANGED
@@ -190,7 +190,7 @@ As you can see, a couple of things are added by the model. You can also access t
|
|
190
190
|
|
191
191
|
app.fetch(@album.cover_image_uid).meta # => {:model_class=>"Album", ...}
|
192
192
|
|
193
|
-
|
193
|
+
"Magic" Attributes
|
194
194
|
------------------
|
195
195
|
An accessor like `cover_image` only relies on the accessor `cover_image_uid` to work.
|
196
196
|
However, in some cases you may want to record some other properties, whether it be for using in queries, or
|
data/extra_docs/Mongo.md
CHANGED
@@ -20,8 +20,8 @@ In config/initializers/dragonfly.rb:
|
|
20
20
|
# Get database name from config/mongoid.yml
|
21
21
|
db = YAML.load_file(Rails.root.join('config/mongoid.yml'))[Rails.env]['database']
|
22
22
|
|
23
|
-
# Configure to use
|
24
|
-
app.configure_with(:
|
23
|
+
# Configure to use ImageMagick, Rails defaults, and the Mongo data store
|
24
|
+
app.configure_with(:imagemagick)
|
25
25
|
app.configure_with(:rails) do |c|
|
26
26
|
c.datastore = Dragonfly::DataStorage::MongoDataStore.new :database => db
|
27
27
|
end
|
data/extra_docs/Processing.md
CHANGED
@@ -19,14 +19,14 @@ and an image object (actually a {Dragonfly::Job Job} object)...
|
|
19
19
|
|
20
20
|
We can process it using any processing methods that have been registered with the processor.
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
The {Dragonfly::Processing::
|
25
|
-
the {Dragonfly::Config::
|
22
|
+
ImageMagickProcessor
|
23
|
+
--------------------
|
24
|
+
The {Dragonfly::Processing::ImageMagickProcessor ImageMagickProcessor} is registered by default by
|
25
|
+
the {Dragonfly::Config::ImageMagick ImageMagick configuration} used by 'dragonfly/rails/images'.
|
26
26
|
|
27
27
|
If not already registered:
|
28
28
|
|
29
|
-
app.processor.register(Dragonfly::Processing::
|
29
|
+
app.processor.register(Dragonfly::Processing::ImageMagickProcessor)
|
30
30
|
|
31
31
|
gives us these methods:
|
32
32
|
|
@@ -45,8 +45,6 @@ gives us these methods:
|
|
45
45
|
|
46
46
|
image.process(:rotate, 45, :background_colour => 'transparent') # default bg black
|
47
47
|
|
48
|
-
image.process(:vignette) # options :x, :y, :radius, :sigma
|
49
|
-
|
50
48
|
The method `thumb` takes a geometry string and calls `resize`, `resize_and_crop` or `crop` accordingly.
|
51
49
|
|
52
50
|
image.process(:thumb, '400x300') # calls resize
|
@@ -67,6 +65,16 @@ Below are some examples of geometry strings:
|
|
67
65
|
'400x300se' # crop, with south-east gravity
|
68
66
|
'400x300+50+100' # crop from the point 50,100 with width, height 400,300
|
69
67
|
|
68
|
+
RMagickProcessor
|
69
|
+
----------------
|
70
|
+
The {Dragonfly::Processing::RMagickProcessor RMagickProcessor} uses the {http://rmagick.rubyforge.org RMagick} library and provides the methods
|
71
|
+
`thumb`, `crop`, `flip`, `flop`, `greyscale`, `resize`, `resize_and_crop` and `rotate` like the ImageMagickProcessor above.
|
72
|
+
|
73
|
+
You can tell it not to use the file system when registering it
|
74
|
+
|
75
|
+
app.processor.register(Dragonfly::Processing::RMagickProcessor){|p| p.use_filesystem = false }
|
76
|
+
|
77
|
+
|
70
78
|
Lazy evaluation
|
71
79
|
---------------
|
72
80
|
|
data/extra_docs/Rack.md
CHANGED
@@ -28,12 +28,11 @@ Example: Using to serve resized images
|
|
28
28
|
require 'rubygems'
|
29
29
|
require 'dragonfly'
|
30
30
|
|
31
|
-
app = Dragonfly[:images]
|
32
|
-
app.configure_with(:rmagick)
|
31
|
+
app = Dragonfly[:images].configure_with(:imagemagick)
|
33
32
|
|
34
33
|
run app
|
35
34
|
|
36
|
-
This enables the app to use all the
|
35
|
+
This enables the app to use all the ImageMagick goodies provided by Dragonfly (see {file:Configuration}).
|
37
36
|
By default the {Dragonfly::DataStorage::FileDataStore file data store} is used.
|
38
37
|
|
39
38
|
In the console:
|
data/extra_docs/Rails2.md
CHANGED
@@ -16,7 +16,7 @@ config/initializers/dragonfly.rb:
|
|
16
16
|
require 'dragonfly'
|
17
17
|
|
18
18
|
app = Dragonfly[:images]
|
19
|
-
app.configure_with(:
|
19
|
+
app.configure_with(:imagemagick)
|
20
20
|
app.configure_with(:rails)
|
21
21
|
|
22
22
|
app.define_macro(ActiveRecord::Base, :image_accessor)
|
@@ -34,8 +34,7 @@ Gems
|
|
34
34
|
----
|
35
35
|
environment.rb
|
36
36
|
|
37
|
-
config.gem 'dragonfly', '~>0.7.
|
38
|
-
config.gem 'rmagick', :lib => 'RMagick'
|
37
|
+
config.gem 'dragonfly', '~>0.7.7'
|
39
38
|
config.gem 'rack-cache', :lib => 'rack/cache'
|
40
39
|
|
41
40
|
Capistrano
|
data/extra_docs/Rails3.md
CHANGED
@@ -16,7 +16,7 @@ config/initializers/dragonfly.rb:
|
|
16
16
|
require 'dragonfly'
|
17
17
|
|
18
18
|
app = Dragonfly[:images]
|
19
|
-
app.configure_with(:
|
19
|
+
app.configure_with(:imagemagick)
|
20
20
|
app.configure_with(:rails)
|
21
21
|
|
22
22
|
app.define_macro(ActiveRecord::Base, :image_accessor)
|
@@ -33,8 +33,7 @@ application.rb:
|
|
33
33
|
Gemfile
|
34
34
|
-------
|
35
35
|
|
36
|
-
gem 'dragonfly', '~>0.7.
|
37
|
-
gem 'rmagick', :require => 'RMagick'
|
36
|
+
gem 'dragonfly', '~>0.7.7'
|
38
37
|
gem 'rack-cache', :require => 'rack/cache'
|
39
38
|
|
40
39
|
Capistrano
|
data/extra_docs/Sinatra.md
CHANGED
@@ -2,7 +2,7 @@ Sinatra
|
|
2
2
|
=======
|
3
3
|
You can use {Dragonfly::Job Job}'s `to_response` method like so:
|
4
4
|
|
5
|
-
app = Dragonfly[:images].configure_with(:
|
5
|
+
app = Dragonfly[:images].configure_with(:imagemagick)
|
6
6
|
|
7
7
|
get '/images/:size.:format' do |size, format|
|
8
8
|
app.fetch_file('~/some/image.png').thumb(size).encode(format).to_response(env)
|
@@ -15,7 +15,7 @@ a path segment.
|
|
15
15
|
|
16
16
|
or you can mount as a middleware, like in rails:
|
17
17
|
|
18
|
-
Dragonfly[:images].configure_with(:
|
18
|
+
Dragonfly[:images].configure_with(:imagemagick) do |c|
|
19
19
|
c.url_path_prefix = '/media'
|
20
20
|
end
|
21
21
|
|
data/extra_docs/URLs.md
CHANGED
@@ -56,8 +56,8 @@ And you can override it:
|
|
56
56
|
|
57
57
|
app.fetch('some/uid').url(:suffix => '/yellowbelly') # "...b21lL3VpZA/yellowbelly"
|
58
58
|
|
59
|
-
Content-Disposition
|
60
|
-
|
59
|
+
Content-Disposition
|
60
|
+
-------------------
|
61
61
|
You can manually set the content-disposition of the response:
|
62
62
|
|
63
63
|
app.content_disposition = :attachment # should be :inline or :attachment (or :hidden)
|
@@ -74,6 +74,8 @@ You can also use a block:
|
|
74
74
|
end
|
75
75
|
}
|
76
76
|
|
77
|
+
Downloaded filename
|
78
|
+
-------------------
|
77
79
|
To specify the filename the browser uses for 'Save As' dialogues:
|
78
80
|
|
79
81
|
app.content_filename = proc{|job, request|
|
@@ -91,9 +93,9 @@ Routed Endpoints
|
|
91
93
|
----------------
|
92
94
|
You can also use a number of Rack-based routers and create Dragonfly endpoints.
|
93
95
|
|
94
|
-
If we have an app set up for using
|
96
|
+
If we have an app set up for using ImageMagick:
|
95
97
|
|
96
|
-
app = Dragonfly[:images].configure_with(:
|
98
|
+
app = Dragonfly[:images].configure_with(:imagemagick)
|
97
99
|
|
98
100
|
Then to get the url '/text/hello' to display the text "hello"...
|
99
101
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: champion uses dragonfly in his Rails 3.0.3 application
|
2
|
+
In order to be a champion
|
3
|
+
A user uses dragonfly in his Rails 3.0.3 application
|
4
|
+
|
5
|
+
Scenario: Set up dragonfly using initializer
|
6
|
+
Given a Rails 3.0.3 application set up for using dragonfly
|
7
|
+
Then the manage_album_images cucumber features in my Rails 3.0.3 app should pass
|
8
|
+
And the text_images cucumber features in my Rails 3.0.3 app should pass
|
@@ -2,7 +2,7 @@ RAILS_APP_NAME = 'tmp_app'
|
|
2
2
|
FIXTURES_PATH = ROOT_PATH + "/fixtures"
|
3
3
|
GEMFILES = {
|
4
4
|
'2.3.5' => ROOT_PATH + '/Gemfile.rails.2.3.5',
|
5
|
-
'3.0.
|
5
|
+
'3.0.3' => ROOT_PATH + '/Gemfile',
|
6
6
|
}
|
7
7
|
|
8
8
|
def fixture_path(version)
|
@@ -17,7 +17,7 @@ end
|
|
17
17
|
|
18
18
|
{
|
19
19
|
'2.3.5' => "BUNDLE_GEMFILE=#{GEMFILES['2.3.5']} rails #{RAILS_APP_NAME} -m template.rb",
|
20
|
-
'3.0.
|
20
|
+
'3.0.3' => "BUNDLE_GEMFILE=#{GEMFILES['3.0.3']} bundle exec rails new #{RAILS_APP_NAME} -m template.rb"
|
21
21
|
}.each do |version, rails_command|
|
22
22
|
|
23
23
|
Given /^a Rails #{version} application set up for using dragonfly$/ do
|
data/features/support/env.rb
CHANGED
@@ -9,7 +9,7 @@ ROOT_PATH = File.expand_path(File.dirname(__FILE__) + "/../..")
|
|
9
9
|
# A hash of <name for reference> => <dragonfly uid> pairs
|
10
10
|
TEMP_FILES = {}
|
11
11
|
|
12
|
-
Dragonfly[:images].configure_with(:
|
12
|
+
Dragonfly[:images].configure_with(:imagemagick)
|
13
13
|
Dragonfly[:files].configure do |c|
|
14
14
|
c.analyser.register(Dragonfly::Analysis::FileCommandAnalyser)
|
15
15
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<% form_for @album, :html => {:multipart => true} do |f| %>
|
2
|
+
<%= f.file_field :cover_image %>
|
3
|
+
<%= f.submit :value => 'Create' %>
|
4
|
+
<% end %>
|