tzispa_experts 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +4 -0
- data/README.md +3 -0
- data/lib/tzispa/experts/image.rb +35 -0
- data/lib/tzispa/experts/version.rb +9 -0
- data/lib/tzispa/experts.rb +8 -0
- data/lib/tzispa_experts.rb +7 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 86527db555738e69667b3aa79ff1d7a965d1cf69
|
4
|
+
data.tar.gz: beba9788bd4b2043076415e1d6ae5fbe721b2ace
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b85e577b5d5b781323f3183a78f608883f193320eb249119528dad1cca4a3dea7e6ab8cb49e3dfaa57e02b11bc289f3c6764b3433138dabcd3a404adb9e44d3
|
7
|
+
data.tar.gz: d0bf0ee5ec8f4ed8bc43b6ac2d607fe08b37971bd40329db5c2a2319e6cd20f4f91a691a86e3acd41e5e976c19f936e093d7ca775fc4368e8e8a547974a52e53
|
data/CHANGELOG.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mini_magick'
|
4
|
+
|
5
|
+
module Tzispa
|
6
|
+
module Experts
|
7
|
+
module Image
|
8
|
+
|
9
|
+
def resize_crop_image(source:, image_size: nil, dest_file: nil, qualiy: 90, crop: false)
|
10
|
+
image_file = dest_file || source
|
11
|
+
if image_size && MiniMagick::Tool::Convert.new do |convert|
|
12
|
+
convert.merge! [source, '-resize', image_size, "-quality", "#{qualiy}", image_file]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
if crop
|
16
|
+
crop_info = MiniMagick::Tool::Convert.new do |convert|
|
17
|
+
convert.merge! [image_file, "-virtual-pixel", " edge", "-blur", "0x15", "-fuzz", "15%", "-trim", "-format", "'%[fx:w+72]x%[fx:h+72]+%[fx:page.x-10]+%[fx:page.y-10]'", "info:" ]
|
18
|
+
end if crop
|
19
|
+
MiniMagick::Tool::Convert.new do |convert|
|
20
|
+
convert.merge! [ image_file, "-crop", "#{crop_info.delete("'")}", "+repage", "-strip", "-interlace", "Plane", "-gaussian-blur", "0.05", image_file ]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def request_upload_image(param:, path:, save_as: nil, keep_ext: true, crop: false, size: nil)
|
26
|
+
if result = request_upload_file( param: param, path: path, save_as: save_as, keep_ext: keep_ext )
|
27
|
+
resize_crop_image( source: result[:path], image_size: size ) if crop
|
28
|
+
end
|
29
|
+
result
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tzispa_experts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Juan Antonio Piñero
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mini_magick
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.3'
|
27
|
+
description: Experts for Tzispa
|
28
|
+
email:
|
29
|
+
- japinero@area-integral.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- CHANGELOG.md
|
35
|
+
- README.md
|
36
|
+
- lib/tzispa/experts.rb
|
37
|
+
- lib/tzispa/experts/image.rb
|
38
|
+
- lib/tzispa/experts/version.rb
|
39
|
+
- lib/tzispa_experts.rb
|
40
|
+
homepage: https://www.area-integral.com
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '2.0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '2.0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.5.1
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: Specialized misc modules for Tzispa framework
|
64
|
+
test_files: []
|