ires 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ires.rb +4 -2
- data/lib/ires/util.rb +8 -8
- data/lib/ires/version.rb +1 -1
- data/lib/ires/view_helper.rb +10 -9
- metadata +4 -5
- data/lib/ires/engine.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0565bf2a942fa52271a911d75f8eff2472eaa57
|
4
|
+
data.tar.gz: 792f9f8516dcd41ac657c60e30de84a924f4f692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc68f28de50c7e0ce82667540c6133453b9085085146781af6f3eb7a680ecd3906ebff4060d93fa08dcfd8c8c02b5adcf3123e50731f864bec2481d88b81908d
|
7
|
+
data.tar.gz: ba4c5bd6e0fea9b8d716793f4df0df790d8e8fed2bd00ad1775db891e781cf3d2afa274c0703b4b25a09e701b8fb72fd1fac77900cb2ead58242f8368057d2f9
|
data/lib/ires.rb
CHANGED
data/lib/ires/util.rb
CHANGED
@@ -6,11 +6,11 @@ module Ires
|
|
6
6
|
# Reszie image directory
|
7
7
|
# return [none(ffi)]
|
8
8
|
def current_os
|
9
|
-
if [
|
10
|
-
|
9
|
+
if ['darwin', 'linux'].include?(os)
|
10
|
+
os
|
11
11
|
else
|
12
12
|
logger.fatal "Ires is not supported by this #{os}"
|
13
|
-
|
13
|
+
nil
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -21,15 +21,15 @@ module Ires
|
|
21
21
|
host_os = RbConfig::CONFIG['host_os']
|
22
22
|
case host_os
|
23
23
|
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
24
|
-
|
24
|
+
'windows'
|
25
25
|
when /darwin|mac os/
|
26
|
-
|
26
|
+
'darwin'
|
27
27
|
when /linux/
|
28
|
-
|
28
|
+
'linux'
|
29
29
|
when /solaris|bsd/
|
30
|
-
|
30
|
+
'unix'
|
31
31
|
else
|
32
|
-
|
32
|
+
'unknown'
|
33
33
|
end
|
34
34
|
)
|
35
35
|
end
|
data/lib/ires/version.rb
CHANGED
data/lib/ires/view_helper.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'action_view/helpers'
|
2
3
|
|
3
4
|
module Ires
|
4
5
|
module ViewHelper
|
5
6
|
|
6
7
|
# Image resize
|
7
8
|
# return [image_tag]
|
8
|
-
def ires_tag(path:, width:, height:, mode:
|
9
|
+
def ires_tag(path:, width:, height:, mode: 'resize', expire: 30.days, **option)
|
9
10
|
full_path = image_full_path(path.to_s)
|
10
11
|
|
11
12
|
# if no image or could not find file path then perform the same action as 'image_tag'
|
@@ -13,25 +14,25 @@ module Ires
|
|
13
14
|
|
14
15
|
# Expiration date (default: 7.days)
|
15
16
|
# ex. "20170101"
|
16
|
-
expiration_date = (Date.today + expire).strftime(
|
17
|
+
expiration_date = (Date.today + expire).strftime('%Y%m%d')
|
17
18
|
|
18
19
|
# Reszie image
|
19
20
|
case mode
|
20
|
-
when
|
21
|
+
when 'resize'
|
21
22
|
@image = Ires::Service.resizeImage(
|
22
23
|
full_path,
|
23
24
|
width,
|
24
25
|
height,
|
25
26
|
image_dir,
|
26
27
|
expiration_date)
|
27
|
-
when
|
28
|
+
when 'crop'
|
28
29
|
@image = Ires::Service.cropImage(
|
29
30
|
full_path,
|
30
31
|
width,
|
31
32
|
height,
|
32
33
|
image_dir,
|
33
34
|
expiration_date)
|
34
|
-
when
|
35
|
+
when 'resize_to_crop'
|
35
36
|
@image = Ires::Service.resizeToCropImage(
|
36
37
|
full_path,
|
37
38
|
width,
|
@@ -50,15 +51,15 @@ module Ires
|
|
50
51
|
# Reszie image directory
|
51
52
|
# return [String]
|
52
53
|
def image_dir
|
53
|
-
@image_dir ||= Pathname.new(Rails.root).join(
|
54
|
+
@image_dir ||= Pathname.new(Rails.root).join('public').to_s
|
54
55
|
end
|
55
56
|
|
56
57
|
def image_full_path(path)
|
57
58
|
root = Rails.root.to_s
|
58
|
-
if path.include?(root) || path.include?(
|
59
|
-
|
59
|
+
if path.include?(root) || path.include?('http')
|
60
|
+
path
|
60
61
|
else
|
61
|
-
|
62
|
+
File.join(image_dir, path)
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ires
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- enta0701
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.1.8
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.1.8
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +117,6 @@ files:
|
|
117
117
|
- ext/vendor/github.com/oliamb/cutter/example_test.go
|
118
118
|
- ext/vendor/github.com/oliamb/cutter/fixtures/gopher.jpg
|
119
119
|
- lib/ires.rb
|
120
|
-
- lib/ires/engine.rb
|
121
120
|
- lib/ires/service.rb
|
122
121
|
- lib/ires/util.rb
|
123
122
|
- lib/ires/version.rb
|