imgkit 1.3.8 → 1.3.9
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/.gitignore +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +52 -4
- data/lib/imgkit/configuration.rb +2 -1
- data/lib/imgkit/version.rb +1 -1
- metadata +4 -4
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# IMGKit
|
3
2
|
|
4
3
|
Create JPGs using plain old HTML+CSS. Uses [wkhtmltoimage](http://github.com/antialize/wkhtmltopdf) on the backend which renders HTML using Webkit.
|
@@ -57,16 +56,48 @@ Heavily based on [PDFKit](http://github.com/jdpace/pdfkit/).
|
|
57
56
|
|
58
57
|
## Configuration
|
59
58
|
|
60
|
-
|
59
|
+
### `wkhtmltoimage` binary location
|
60
|
+
|
61
|
+
If you're on Windows or you installed `wkhtmltoimage` by hand to a location other than `/usr/local/bin` you will need to tell IMGKit where the binary is. You can configure IMGKit like so:
|
61
62
|
|
62
63
|
# config/initializers/imgkit.rb
|
63
64
|
IMGKit.configure do |config|
|
64
65
|
config.wkhtmltoimage = '/path/to/wkhtmltoimage'
|
66
|
+
end
|
67
|
+
|
68
|
+
### Default image format
|
69
|
+
|
70
|
+
May be set to one of [`IMGKit::KNOWN_FORMATS = [:jpg, :jpeg, :png, :tiff, :tif]`](https://github.com/csquared/IMGKit/blob/d3755e2c23ba605da2f41e17f3edc99f3037d1c7/lib/imgkit/imgkit.rb#L2)
|
71
|
+
|
72
|
+
config.default_format = :png
|
73
|
+
|
74
|
+
### Prefix for `<meta>` tag options (see **Usage**) :
|
75
|
+
|
76
|
+
May be changed from its default (`imgkit-`):
|
77
|
+
|
78
|
+
config.meta_tag_prefix = 'imgkit-option'
|
79
|
+
|
80
|
+
### Additional default options
|
81
|
+
|
82
|
+
Any flag accepted by `wkhtmltoimage` may be set thus:
|
83
|
+
|
65
84
|
config.default_options = {
|
66
85
|
:quality => 60
|
67
86
|
}
|
68
|
-
|
69
|
-
|
87
|
+
|
88
|
+
For a flag which takes no parameters, use `true` for the value:
|
89
|
+
|
90
|
+
'no-images' => true
|
91
|
+
|
92
|
+
For flags with multiple parameters, use an array:
|
93
|
+
|
94
|
+
:cookie => ['my_session', '123BADBEEF456']
|
95
|
+
|
96
|
+
### Overriding options
|
97
|
+
|
98
|
+
When initializing an `IMGKit` options may be may be set for the life time of the `IMGKit` object:
|
99
|
+
|
100
|
+
IMGKit.new('http://example.com/form', :post => ['my_field', 'my_unique_value'])
|
70
101
|
|
71
102
|
## Heroku
|
72
103
|
|
@@ -216,6 +247,23 @@ Contributed by @ticktricktrack
|
|
216
247
|
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
217
248
|
* Send me a pull request. Bonus points for topic branches.
|
218
249
|
|
250
|
+
## Testing
|
251
|
+
|
252
|
+
Make sure the tests pass in the following ruby versions:
|
253
|
+
|
254
|
+
- 1.8.7-p370
|
255
|
+
- 1.9.2-p290
|
256
|
+
- 1.9.3-p194
|
257
|
+
|
258
|
+
You can simply
|
259
|
+
|
260
|
+
$ rbenv-install <version>
|
261
|
+
$ rbenv shell <version>
|
262
|
+
$ bundle
|
263
|
+
$ bundle exec rake
|
264
|
+
|
265
|
+
For each version
|
266
|
+
|
219
267
|
## Copyright
|
220
268
|
|
221
269
|
Copyright (c) 2010 <a href="mailto:christopher.continanza@gmail.com">Chris Continanza</a>
|
data/lib/imgkit/configuration.rb
CHANGED
@@ -4,9 +4,10 @@ class IMGKit
|
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@meta_tag_prefix = 'imgkit-'
|
7
|
-
@wkhtmltoimage = '/usr/local/bin/wkhtmltoimage'
|
8
7
|
@default_options = {:height => 1000}
|
9
8
|
@default_format = :jpg
|
9
|
+
@wkhtmltoimage ||= (defined?(Bundler::GemfileError) ? `bundle exec which wkhtmltoimage` : `which wkhtmltoimage`).chomp
|
10
|
+
@wkhtmltoimage = '/usr/local/bin/wkhtmltoimage' if @wkhtmltoimage.strip.empty? # Fallback
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
data/lib/imgkit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Uses wkhtmltoimage to create Images using HTML
|
15
15
|
email: christopher.continanza@gmail.com
|
@@ -61,7 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
segments:
|
63
63
|
- 0
|
64
|
-
hash:
|
64
|
+
hash: -4155335714113497947
|
65
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
segments:
|
72
72
|
- 0
|
73
|
-
hash:
|
73
|
+
hash: -4155335714113497947
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project: imgkit
|
76
76
|
rubygems_version: 1.8.23
|