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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWY4ODQ3ZTRlN2UwNDU4Njk3N2E2MzBjOTUzZDYxMjI4ZjlhZjZiZg==
4
+ ZDkzMDVjOTcyY2UyZDY0YTRkN2JhNWI5YTExNDc3N2FkNWJmODE0OQ==
5
5
  data.tar.gz: !binary |-
6
- OTgxNWM0Mzc3ODUwMjhjYTg1ZjM1ZmZmOTcyOTEyYjEyZGQ4ZWUxZQ==
6
+ ZWU1Yjc4ZGJkMTc1NDYxZmU5ZjAwNzVjZGFmOTdmMjA3Yjg2NTE0Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Yjc3ZDFjYTNiZmYyYzEyOTZlNTBhYTY0YTA5ZmM5Mjc1NjI3OGYwZGRmMmMz
10
- ZWJiOTk2MzZiZTkxMWNlYWYyNjg0MWIxNWUzNjRmMGQ0NzM2MzI4YTNhOTYx
11
- MDdiMWM1ZjRmYmIzMjFlMThhNmZjNTU2YzgyMWUzNGEyMGQzNWM=
9
+ NmM2ZjY1YTE4MmEyNzE5MmI0NWIyODM1MjcyNjM1MWY0NTcxOTc2OWJmZmYw
10
+ NDMzOGRmNjRiMTdjNTI0MzYyYjMxOTBmZjRmYWVlOTRjNWUzZjgxNmRkMjFm
11
+ NzIwODI4MThiYjg3MWQ4NTc5NTE2ZGFjMjM5NTA1MmE5MzdlZjQ=
12
12
  data.tar.gz: !binary |-
13
- ZjExMjgzMTM4ODBlZWRiMjlmY2M5ODdmNzNiNGY2MjcwMzE4MTI3MjMwNTc5
14
- YjA0N2VlMDU4NjgyYmEyN2ZhM2RmYjdhMDliYTg0MmEwZGNlOWZhYjQ5MmIy
15
- ZWYwYjM1YjUzNmYzNjE3ZjM3ZTIyMzY3NDU2NjQ0NjAxOTBmYTY=
13
+ NjM5M2ZlNWUyYWI1YTJkMWQ1ZjAxYTJhMGFiNWZhYzUzOWQ4Mzg4ZDE1NTZm
14
+ NzEyMWEzY2U5ZTBkNDVjMDY0ZjgzODQ0OTY2Y2ZkZDY5ZmZiNjFmYTU1MTMx
15
+ ODY4OTRkMWM1Yzc0MzVlOGE3ZmE1OGZhZGY0YjQwM2EzZmI0OGY=
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ group :development do
9
9
  gem 'fakeweb'
10
10
  gem 'pry'
11
11
  gem 'fastimage'
12
- gem 'rmagick'
13
12
  # gem 'debugger'
14
13
  # gem 'better_errors'
15
- end
14
+ end
15
+
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phantoshot (0.0.1)
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 'rmagick'
3
- include Magick
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.read(tempfile.path)[0]
26
- org_width = img.columns
27
- org_height = img.rows
25
+ img = MiniMagick::Image.open(tempfile.path)
28
26
 
29
- if desired_width
30
- img = img.resize_to_fit(desired_width, org_height)
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 = img.crop(0, 0, img.columns, desired_height)
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
@@ -1,3 +1,3 @@
1
1
  module Phantoshot
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_dependency "hashie"
24
24
  spec.add_dependency "multi_json"
25
+ spec.add_dependency 'mini_magick'
25
26
 
26
27
 
27
28
  end
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.5
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