imgkit 1.3.5 → 1.3.6

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.
Files changed (4) hide show
  1. data/README.md +22 -0
  2. data/bin/imgkit +2 -2
  3. data/lib/imgkit/version.rb +1 -1
  4. metadata +4 -4
data/README.md CHANGED
@@ -143,6 +143,28 @@ To overcome the lack of support for --user-style-sheet option by wkhtmltoimage 0
143
143
 
144
144
  kit.stylesheets << css
145
145
 
146
+ ## CarrierWave Workaround
147
+
148
+ Contributed by @ticktricktrack
149
+
150
+ ```ruby
151
+ class MyClass < ActiveRecord::Base
152
+ mount_uploader :snapshot, SnapshotUploader
153
+
154
+ after_create :take_snapshot
155
+
156
+ # private
157
+
158
+ def take_snapshot
159
+ file = Tempfile.new(["template_#{self.id.to_s}", 'jpg'], 'tmp', :encoding => 'ascii-8bit')
160
+ file.write(IMGKit.new(self.html_body, quality: 50, width: 600).to_jpg)
161
+ self.snapshot = file
162
+ file.unlink
163
+ self.save
164
+ end
165
+ end
166
+ ```
167
+
146
168
 
147
169
  ## Note on Patches/Pull Requests
148
170
 
data/bin/imgkit CHANGED
@@ -52,7 +52,7 @@ def install(download, arch, install_to)
52
52
  puts "Installing #{download} to #{install_to}"
53
53
  if download =~ /.tar.bz2$/
54
54
  `sudo tar xjvf #{download}`
55
- `sudo mv wkhtmltoimage #{install_to}`
55
+ `sudo mv wkhtmltoimage-#{arch} #{install_to}`
56
56
  elsif download =~ /.tar.lzma$/
57
57
  raise "couldn't extract archive: lzcat not found" unless system("which lzcat > /dev/null 2>/dev/null")
58
58
  puts "Warning: lzcat is broken on Ubuntu. Re-run with --use-bzip to install alternate version"
@@ -76,7 +76,7 @@ OptionParser.new do |parser|
76
76
  parser.on("--install-wkhtmltoimage", "Install wkhtmltoimage binaries (TO=/usr/local/bin ARCHITECTURE=i386)") do
77
77
  @command = Proc.new do
78
78
  architecture = ENV['ARCHITECTURE'] || detect_architecture
79
- install_to = ENV['TO'] || IMGKit.configuration.wkhtmltoimage
79
+ install_to = ENV['TO']+'/wkhtmltoimage' || IMGKit.configuration.wkhtmltoimage
80
80
 
81
81
  Dir.chdir '/tmp'
82
82
 
@@ -1,3 +1,3 @@
1
1
  class IMGKit
2
- VERSION = "1.3.5"
2
+ VERSION = "1.3.6"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imgkit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 5
10
- version: 1.3.5
9
+ - 6
10
+ version: 1.3.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - csquared
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-09 00:00:00 -08:00
18
+ date: 2012-03-24 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21