live_paper 0.0.30 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3a33bcee29e2d5803a25dee71fcde7623c4f4bf
4
- data.tar.gz: f2c95bfd09d248703728c87af7dc6df872b8341e
3
+ metadata.gz: 4676cbec23ccb78f889c521e7103e67e07b5769f
4
+ data.tar.gz: 69a223c392f5ba6031c8bbaa44d270efae5bba2d
5
5
  SHA512:
6
- metadata.gz: 1a70a21715ca5af629541e1e1f89e6bf1d040edc376cac587d1bf7cffb6063b046c9da0720e74ec6647745b3c23503ab695905d4c40fe59c6c4125164ba4fb66
7
- data.tar.gz: 2a3c1e20b8427dcd43f4651cf762cda52e1be38c3e5e29bf4b971014ae3ac999eb1d36e16ff71c4f14e9a4b7109b532bf92678ff38c7f58e09f59d9dc2812129
6
+ metadata.gz: 93d8df53b26cb76ac98592683d4d4106cd92b7670f6fd03b471d31b457a529bdae79154e59a10fbc422836dcdb046e9fe8955246518b910a83863bf8091d367a
7
+ data.tar.gz: f2a195e25d7c23a8a39e58f19a5c74d3cbf952b8bb4f82768eea2db0565315b8f48a4bd2a01daabe793d39c24e348028e7ddcf02b8addd3bfcfc0ac6ec9fb13d
data/README.md CHANGED
@@ -4,6 +4,16 @@ Provides a ruby interface to the Live Paper service by HP for creating watermark
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/live_paper.svg)](http://badge.fury.io/rb/live_paper)
6
6
 
7
+ ## Requirements
8
+
9
+ ImageMagick or GraphicsMagick command-line tool has to be installed. You can check if you have it installed by running
10
+ ```
11
+ $ convert -version
12
+ Version: ImageMagick 6.8.9-5 Q16 x86_64 2014-07-25 http://www.imagemagick.org
13
+ Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
14
+ Features: DPC Modules
15
+ Delegates: bzlib freetype jng jpeg ltdl lzma png xml zlib
16
+ ```
7
17
 
8
18
  ## Installation
9
19
 
@@ -1,3 +1,3 @@
1
1
  module LivePaper
2
- VERSION = "0.0.30"
2
+ VERSION = "0.0.31"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require_relative 'base_object'
2
+ require 'mini_magick'
2
3
 
3
4
  module LivePaper
4
5
  class WmTrigger < Trigger
@@ -17,14 +18,22 @@ module LivePaper
17
18
  def download_watermark(image_url, options = {})
18
19
  resolution = options[:resolution] || WATERMARK_RESOLUTION
19
20
  strength = options[:strength] || WATERMARK_STRENGTH
20
- ppi = options[:ppi] || DEFAULT_IMAGE_RESOLUTION
21
+ ppi = options[:ppi]
22
+ if ppi.blank?
23
+ image = MiniMagick::Image.open(image_url + "?access_token=" + $lpp_access_token)
24
+ ppiArray = image.resolution("PixelsPerInch") #This returns the [xResolution, yResolution]
25
+ ppi = ppiArray[0] if (ppiArray.present? && ppiArray.length > 0)
26
+ end
27
+ if ppi.blank?
28
+ ppi = DEFAULT_IMAGE_RESOLUTION
29
+ end
30
+
21
31
  url = "#{self.wm_url}?imageURL=#{CGI.escape(image_url)}&resolution=#{resolution}&ppi=#{ppi}&strength=#{strength}"
22
32
  begin
23
33
  response = WmTrigger.rest_request( url, :get, accept: "image/jpg" )
24
34
  response.body.empty? ? nil : response.body
25
35
  rescue Exception => e
26
- puts 'Exception!\n'
27
- puts e.response
36
+ puts "Exception : #{e.to_s}\n"
28
37
  end
29
38
  end
30
39
 
data/live_paper.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "activesupport"
22
+ spec.add_dependency "mini_magick"
22
23
  spec.add_runtime_dependency "rest-client"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.6"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: live_paper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Whitmarsh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-02 00:00:00.000000000 Z
12
+ date: 2015-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - '>='
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: mini_magick
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: rest-client
30
44
  requirement: !ruby/object:Gem::Requirement