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 +4 -4
- data/README.md +10 -0
- data/lib/live_paper/version.rb +1 -1
- data/lib/live_paper/wm_trigger.rb +12 -3
- data/live_paper.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4676cbec23ccb78f889c521e7103e67e07b5769f
|
4
|
+
data.tar.gz: 69a223c392f5ba6031c8bbaa44d270efae5bba2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/live_paper/version.rb
CHANGED
@@ -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]
|
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
|
27
|
-
puts e.response
|
36
|
+
puts "Exception : #{e.to_s}\n"
|
28
37
|
end
|
29
38
|
end
|
30
39
|
|
data/live_paper.gemspec
CHANGED
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.
|
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-
|
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
|