alchemy_cloudinary 1.0.0 → 2.0.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92be864931cbc2daaf0edb89fb37823b1a868fc7c8b98410592c9cba8a7b6b32
|
4
|
+
data.tar.gz: 36f55ef8d2c3fc6c974cc5431a59184aed26fabedbb4cbe609a658ff8407c7ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 035360a4811a93b162eb3e397f6b33e6f85ec93795fab37c4fc8040536ec494c4482b85e45d8aadbf224e21a56b2eeb0ca918df4381ab2cfaebec766719fed9a
|
7
|
+
data.tar.gz: 625ad8541930f62347c8053226a7be2fb7d8ad5e1e4266720dc80e7058f06f9a70de83281dbb4a5fe75108737e2441bee8159330d15f8e252b82527742bb5044
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module AlchemyCloudinary
|
4
4
|
class Engine < ::Rails::Engine
|
5
5
|
config.before_initialize do
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "dragonfly"
|
7
|
+
require "alchemy_cloudinary/dragonfly_data_store"
|
8
8
|
|
9
9
|
Dragonfly::App.register_datastore(:alchemy_cloudinary) do
|
10
10
|
AlchemyCloudinary::DragonflyDataStore
|
@@ -12,9 +12,8 @@ module AlchemyCloudinary
|
|
12
12
|
end
|
13
13
|
|
14
14
|
config.to_prepare do
|
15
|
-
|
16
|
-
|
17
|
-
Alchemy::Picture.prepend(Alchemy::Picture::CloudinaryUrl)
|
15
|
+
::Alchemy::Picture.url_class = ::Alchemy::Picture::CloudinaryUrl
|
16
|
+
::Alchemy::PictureThumb.generator_class = ::AlchemyCloudinary::CreatePictureThumb
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
data/lib/alchemy_cloudinary.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy_cloudinary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas von Deyen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alchemy_cms
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.1.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 5.1.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: cloudinary
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.9'
|
47
|
-
description: AlchemyCMS
|
47
|
+
description: Render AlchemyCMS images directly from cloudinary.
|
48
48
|
email:
|
49
49
|
- thomas@vondeyen.com
|
50
50
|
executables: []
|
@@ -53,8 +53,8 @@ extra_rdoc_files: []
|
|
53
53
|
files:
|
54
54
|
- MIT-LICENSE
|
55
55
|
- README.md
|
56
|
-
- lib/alchemy/picture/cloudinary_url.rb
|
57
56
|
- lib/alchemy_cloudinary.rb
|
57
|
+
- lib/alchemy_cloudinary/create_picture_thumb.rb
|
58
58
|
- lib/alchemy_cloudinary/dragonfly_data_store.rb
|
59
59
|
- lib/alchemy_cloudinary/engine.rb
|
60
60
|
- lib/alchemy_cloudinary/version.rb
|
@@ -62,7 +62,7 @@ homepage: https://alchemy-cms.com
|
|
62
62
|
licenses:
|
63
63
|
- MIT
|
64
64
|
metadata: {}
|
65
|
-
post_install_message:
|
65
|
+
post_install_message:
|
66
66
|
rdoc_options: []
|
67
67
|
require_paths:
|
68
68
|
- lib
|
@@ -77,8 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
81
|
-
signing_key:
|
80
|
+
rubygems_version: 3.1.6
|
81
|
+
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: AlchemyCMS Cloudinary Integration.
|
84
84
|
test_files: []
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
module Picture::CloudinaryUrl
|
5
|
-
def url(options = {})
|
6
|
-
@options = options
|
7
|
-
image_file.remote_url(transformation: transformations, secure: !!options[:secure])
|
8
|
-
end
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def transformations
|
13
|
-
[crop_transformation, resize_transformation].compact
|
14
|
-
end
|
15
|
-
|
16
|
-
def crop_transformation
|
17
|
-
if @options[:crop] && @options[:crop_from].present?
|
18
|
-
{
|
19
|
-
crop: 'crop',
|
20
|
-
gravity: 'xy_center',
|
21
|
-
x: crop_coordinates[:x],
|
22
|
-
y: crop_coordinates[:y],
|
23
|
-
size: @options[:crop_size]
|
24
|
-
}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def resize_transformation
|
29
|
-
crop_mode = @options[:crop] ? 'fill' : @options[:upsample] ? 'fit' : 'limit'
|
30
|
-
if @options[:size]
|
31
|
-
{
|
32
|
-
crop: crop_mode,
|
33
|
-
size: @options[:size]
|
34
|
-
}
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def crop_coordinates
|
39
|
-
x, y = @options[:crop_from].to_s.split('x')
|
40
|
-
size_x, size_y = @options[:crop_size].to_s.split('x')
|
41
|
-
{
|
42
|
-
x: (x.to_i + size_x.to_f / 2).round,
|
43
|
-
y: (y.to_i + size_y.to_f / 2).round
|
44
|
-
}
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|