utopia 0.9.36 → 0.9.37
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/utopia/tags/gallery.rb +16 -2
- data/lib/utopia/version.rb +1 -1
- metadata +22 -5
data/lib/utopia/tags/gallery.rb
CHANGED
@@ -15,7 +15,12 @@ class Utopia::Tags::Gallery
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def call(img)
|
18
|
-
|
18
|
+
# Only resize an image if it is bigger than the given size.
|
19
|
+
if (img.columns > @size[0] || img.rows > @size[1])
|
20
|
+
img.resize_to_fit(*@size)
|
21
|
+
else
|
22
|
+
img
|
23
|
+
end
|
19
24
|
end
|
20
25
|
|
21
26
|
def default_extension(path)
|
@@ -30,6 +35,13 @@ class Utopia::Tags::Gallery
|
|
30
35
|
end
|
31
36
|
end
|
32
37
|
|
38
|
+
# Resize the image to fit within the specified dimensions while retaining the aspect ratio of the original image. If necessary, crop the image in the larger dimension.
|
39
|
+
class CropThumbnail < Thumbnail
|
40
|
+
def call(img)
|
41
|
+
img.resize_to_fill(*@size)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
33
45
|
class DocumentThumbnail < Thumbnail
|
34
46
|
def call(img)
|
35
47
|
img = super(img)
|
@@ -75,7 +87,9 @@ class Utopia::Tags::Gallery
|
|
75
87
|
PROCESSES = {
|
76
88
|
:pdf_thumbnail => Processes::DocumentThumbnail.new([300, 300]),
|
77
89
|
:photo_thumbnail => Processes::PhotoThumbnail.new([300, 300]),
|
78
|
-
:large => Processes::Thumbnail.new([800, 800])
|
90
|
+
:large => Processes::Thumbnail.new([800, 800]),
|
91
|
+
:square_thumbnail => Processes::CropThumbnail.new([300, 300]),
|
92
|
+
:thumbnail => Processes::Thumbnail.new([300, 300])
|
79
93
|
}
|
80
94
|
|
81
95
|
class ImagePath
|
data/lib/utopia/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 113
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
9
|
+
- 37
|
10
|
+
version: 0.9.37
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Samuel Williams
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-25 00:00:00 +12:00
|
18
19
|
default_executable: utopia
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: mime-types
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -33,9 +36,11 @@ dependencies:
|
|
33
36
|
name: rack
|
34
37
|
prerelease: false
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ">="
|
38
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
39
44
|
segments:
|
40
45
|
- 0
|
41
46
|
version: "0"
|
@@ -45,9 +50,11 @@ dependencies:
|
|
45
50
|
name: activesupport
|
46
51
|
prerelease: false
|
47
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
48
54
|
requirements:
|
49
55
|
- - ">="
|
50
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
51
58
|
segments:
|
52
59
|
- 0
|
53
60
|
version: "0"
|
@@ -57,9 +64,11 @@ dependencies:
|
|
57
64
|
name: rack-cache
|
58
65
|
prerelease: false
|
59
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
60
68
|
requirements:
|
61
69
|
- - ">="
|
62
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
63
72
|
segments:
|
64
73
|
- 0
|
65
74
|
version: "0"
|
@@ -69,9 +78,11 @@ dependencies:
|
|
69
78
|
name: rack-contrib
|
70
79
|
prerelease: false
|
71
80
|
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - ">="
|
74
84
|
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
75
86
|
segments:
|
76
87
|
- 0
|
77
88
|
version: "0"
|
@@ -81,9 +92,11 @@ dependencies:
|
|
81
92
|
name: rmagick
|
82
93
|
prerelease: false
|
83
94
|
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
84
96
|
requirements:
|
85
97
|
- - ">="
|
86
98
|
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
87
100
|
segments:
|
88
101
|
- 0
|
89
102
|
version: "0"
|
@@ -163,25 +176,29 @@ rdoc_options: []
|
|
163
176
|
require_paths:
|
164
177
|
- lib
|
165
178
|
required_ruby_version: !ruby/object:Gem::Requirement
|
179
|
+
none: false
|
166
180
|
requirements:
|
167
181
|
- - ">="
|
168
182
|
- !ruby/object:Gem::Version
|
183
|
+
hash: 3
|
169
184
|
segments:
|
170
185
|
- 0
|
171
186
|
version: "0"
|
172
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
173
189
|
requirements:
|
174
190
|
- - ">="
|
175
191
|
- !ruby/object:Gem::Version
|
192
|
+
hash: 3
|
176
193
|
segments:
|
177
194
|
- 0
|
178
195
|
version: "0"
|
179
196
|
requirements: []
|
180
197
|
|
181
198
|
rubyforge_project:
|
182
|
-
rubygems_version: 1.3.
|
199
|
+
rubygems_version: 1.3.7
|
183
200
|
signing_key:
|
184
|
-
specification_version:
|
201
|
+
specification_version: 3
|
185
202
|
summary: Utopia is a framework for building websites.
|
186
203
|
test_files: []
|
187
204
|
|