phantoshot 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +2 -2
- data/Gemfile.lock +5 -3
- data/lib/phantoshot/make_screenshot.rb +10 -9
- data/lib/phantoshot/version.rb +1 -1
- data/phantoshot.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDkzMDVjOTcyY2UyZDY0YTRkN2JhNWI5YTExNDc3N2FkNWJmODE0OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWU1Yjc4ZGJkMTc1NDYxZmU5ZjAwNzVjZGFmOTdmMjA3Yjg2NTE0Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmM2ZjY1YTE4MmEyNzE5MmI0NWIyODM1MjcyNjM1MWY0NTcxOTc2OWJmZmYw
|
10
|
+
NDMzOGRmNjRiMTdjNTI0MzYyYjMxOTBmZjRmYWVlOTRjNWUzZjgxNmRkMjFm
|
11
|
+
NzIwODI4MThiYjg3MWQ4NTc5NTE2ZGFjMjM5NTA1MmE5MzdlZjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjM5M2ZlNWUyYWI1YTJkMWQ1ZjAxYTJhMGFiNWZhYzUzOWQ4Mzg4ZDE1NTZm
|
14
|
+
NzEyMWEzY2U5ZTBkNDVjMDY0ZjgzODQ0OTY2Y2ZkZDY5ZmZiNjFmYTU1MTMx
|
15
|
+
ODY4OTRkMWM1Yzc0MzVlOGE3ZmE1OGZhZGY0YjQwM2EzZmI0OGY=
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
phantoshot (0.0.
|
4
|
+
phantoshot (0.0.5)
|
5
5
|
hashie
|
6
6
|
multi_json
|
7
7
|
|
@@ -18,13 +18,14 @@ GEM
|
|
18
18
|
thor (>= 0.13.6)
|
19
19
|
hashie (2.0.5)
|
20
20
|
method_source (0.8.1)
|
21
|
+
mini_magick (3.6.0)
|
22
|
+
subexec (~> 0.2.1)
|
21
23
|
multi_json (1.7.6)
|
22
24
|
pry (0.9.12.2)
|
23
25
|
coderay (~> 1.0.5)
|
24
26
|
method_source (~> 0.8)
|
25
27
|
slop (~> 3.4)
|
26
28
|
rake (10.0.4)
|
27
|
-
rmagick (2.13.2)
|
28
29
|
rspec (2.13.0)
|
29
30
|
rspec-core (~> 2.13.0)
|
30
31
|
rspec-expectations (~> 2.13.0)
|
@@ -34,6 +35,7 @@ GEM
|
|
34
35
|
diff-lcs (>= 1.1.3, < 2.0)
|
35
36
|
rspec-mocks (2.13.1)
|
36
37
|
slop (3.4.5)
|
38
|
+
subexec (0.2.3)
|
37
39
|
thor (0.18.1)
|
38
40
|
|
39
41
|
PLATFORMS
|
@@ -44,8 +46,8 @@ DEPENDENCIES
|
|
44
46
|
fakeweb
|
45
47
|
fastimage
|
46
48
|
foreman
|
49
|
+
mini_magick
|
47
50
|
phantoshot!
|
48
51
|
pry
|
49
52
|
rake
|
50
|
-
rmagick
|
51
53
|
rspec (~> 2.8)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Phantoshot
|
2
|
-
require '
|
3
|
-
include
|
2
|
+
require 'mini_magick'
|
3
|
+
include MiniMagick
|
4
4
|
|
5
5
|
def make_screenshot(url, opts={})
|
6
6
|
|
@@ -22,16 +22,15 @@ include Magick
|
|
22
22
|
tempfile.write(hsh[:image_data])
|
23
23
|
tempfile.close
|
24
24
|
|
25
|
-
img = Image.
|
26
|
-
org_width = img.columns
|
27
|
-
org_height = img.rows
|
25
|
+
img = MiniMagick::Image.open(tempfile.path)
|
28
26
|
|
29
|
-
|
30
|
-
|
27
|
+
|
28
|
+
if desired_width && desired_width < img[:width]
|
29
|
+
img.resize(desired_width)
|
31
30
|
end
|
32
31
|
|
33
|
-
if desired_height
|
34
|
-
img
|
32
|
+
if !desired_height.nil? && desired_height < img[:height]
|
33
|
+
img.crop("#{img[:width]}x#{desired_height}+0+0")
|
35
34
|
end
|
36
35
|
|
37
36
|
tempfile2 = Tempfile.new('bar.png')
|
@@ -41,6 +40,8 @@ include Magick
|
|
41
40
|
|
42
41
|
tempfile2.close
|
43
42
|
|
43
|
+
hsh[:width] = img[:width]
|
44
|
+
hsh[:height] = img[:height]
|
44
45
|
hsh[:image_data] = open(tempfile2.path){ |f| f.read }
|
45
46
|
return hsh
|
46
47
|
end
|
data/lib/phantoshot/version.rb
CHANGED
data/phantoshot.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phantoshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Callahan
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: mini_magick
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
70
84
|
description: Take screenshots with phantom.js
|
71
85
|
email:
|
72
86
|
- dn@gskift.com
|