README.md in imgkit-1.6.1 vs README.md in imgkit-1.6.2
- old
+ new
@@ -11,18 +11,18 @@
### IMGKit
gem install imgkit
### wkhtmltoimage
- 1. Use installer: `sudo imgkit --install-wkhtmltoimage`
- install latest version into /usr/local/bin
- (overwrite defaults with e.g. ARCHITECTURE=amd64 TO=/home/foo/bin)
- 2. Install by hand: [http://wkhtmltopdf.org/downloads.html](http://wkhtmltopdf.org/downloads.html)
- 3. Try using the `wkhtmltoimage-binary` gem (mac + linux)
+ 1. Use the `wkhtmltoimage-binary` gem (mac + linux)
```
gem install wkhtmltoimage-binary
```
+ 2. Install by hand: [http://wkhtmltopdf.org/downloads.html](http://wkhtmltopdf.org/downloads.html)
+ 3. Use installer: `sudo imgkit --install-wkhtmltoimage`
+ install latest version into /usr/local/bin
+ (overwrite defaults with e.g. ARCHITECTURE=amd64 TO=/home/foo/bin)
## Usage
# IMGKit.new takes the HTML and any options for wkhtmltoimage
# run `wkhtmltoimage --extended-help` for a full list of options
@@ -150,11 +150,11 @@
- or -
respond_to do |format|
send_data(@kit.to_img(format.to_sym),
- :type => "image/png", :disposition => 'inline')
+ :type => "image/#{format}", :disposition => 'inline')
end
This allows you to take advantage of rails page caching so you only generate the
image when you need to.
@@ -226,10 +226,10 @@
after_create :take_snapshot
# private
def take_snapshot
- file = Tempfile.new(["template_#{self.id.to_s}", 'jpg'], 'tmp', :encoding => 'ascii-8bit')
+ file = Tempfile.new(["template_#{self.id.to_s}", '.jpg'], 'tmp', :encoding => 'ascii-8bit')
file.write(IMGKit.new(self.html_body, quality: 50, width: 600).to_jpg)
file.flush
self.snapshot = file
self.save
file.unlink