spud_media 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -5,10 +5,16 @@
|
|
5
5
|
img.size-50-thumb {
|
6
6
|
height:50px !important;
|
7
7
|
}
|
8
|
-
|
8
|
+
img.size-75-thumb {
|
9
|
+
max-width:75px;
|
10
|
+
max-height:75px;
|
11
|
+
}
|
9
12
|
#details{
|
10
13
|
padding-bottom: 25px;
|
11
14
|
}
|
15
|
+
.page_row{
|
16
|
+
padding: 5px 0 5px 5px;
|
17
|
+
}
|
12
18
|
|
13
19
|
/* Crop tool
|
14
20
|
------------------------ */
|
data/app/models/spud_media.rb
CHANGED
@@ -10,7 +10,7 @@ class SpudMedia < ActiveRecord::Base
|
|
10
10
|
attachment.instance.is_protected ? Spud::Media.storage_path_protected : Spud::Media.storage_path
|
11
11
|
},
|
12
12
|
:url => Spud::Media.storage_url,
|
13
|
-
:styles => lambda { |attachment| attachment.instance.
|
13
|
+
:styles => lambda { |attachment| attachment.instance.dynamic_styles }
|
14
14
|
|
15
15
|
attr_accessible :attachment_content_type,:attachment_file_name,:attachment_file_size,:attachment, :is_protected, :crop_x, :crop_y, :crop_w, :crop_h, :crop_s
|
16
16
|
|
@@ -27,7 +27,11 @@ class SpudMedia < ActiveRecord::Base
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def image_from_type
|
30
|
-
|
30
|
+
|
31
|
+
if self.is_image? || self.is_pdf?
|
32
|
+
return self.attachment.url(:small)
|
33
|
+
|
34
|
+
elsif self.attachment_content_type.blank?
|
31
35
|
return "spud/admin/files_thumbs/dat_thumb.png"
|
32
36
|
|
33
37
|
elsif self.attachment_content_type.match(/jpeg|jpg/)
|
@@ -69,16 +73,27 @@ class SpudMedia < ActiveRecord::Base
|
|
69
73
|
end
|
70
74
|
end
|
71
75
|
|
76
|
+
def is_pdf?
|
77
|
+
if self.attachment_content_type.match(/pdf/)
|
78
|
+
return true
|
79
|
+
else
|
80
|
+
return false
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
72
84
|
def has_custom_crop?
|
73
85
|
return (crop_x && crop_y && crop_w && crop_h && crop_s)
|
74
86
|
end
|
75
87
|
|
76
|
-
def
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
88
|
+
def dynamic_styles
|
89
|
+
styles = {}
|
90
|
+
if is_image? || is_pdf?
|
91
|
+
styles[:small] = '75x75'
|
92
|
+
if has_custom_crop?
|
93
|
+
styles[:cropped] = {:geometry => '', :convert_options => "-resize #{crop_s}% -crop #{crop_w}x#{crop_h}+#{crop_x}+#{crop_y}"}
|
94
|
+
end
|
81
95
|
end
|
96
|
+
return styles
|
82
97
|
end
|
83
98
|
|
84
99
|
# if you are using S3, attachment.url will automatically point to the S3 url
|
@@ -40,7 +40,7 @@
|
|
40
40
|
<div id="spud_media_cropper_outer">
|
41
41
|
<div id="spud_media_cropper">
|
42
42
|
<div id="spud_media_cropper_jcrop_container">
|
43
|
-
<%=
|
43
|
+
<img src="<%= @media.attachment_url(:original) %>" id="spud_media_cropper_image" />
|
44
44
|
</div>
|
45
45
|
</div>
|
46
46
|
</div>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<div class="page_row">
|
8
8
|
|
9
9
|
<span class="row_meta">
|
10
|
-
<%=image_tag(media.image_from_type,:class => "size-
|
10
|
+
<%=image_tag(media.image_from_type,:class => "size-75-thumb")%>
|
11
11
|
<%=link_to media.attachment.url.split("/").last, media.attachment_url %>
|
12
12
|
</span>
|
13
13
|
|
data/lib/spud_media/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spud_media
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 3.2.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.2
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: spud_core
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -35,10 +40,18 @@ dependencies:
|
|
35
40
|
version: 0.9.0
|
36
41
|
type: :runtime
|
37
42
|
prerelease: false
|
38
|
-
version_requirements:
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.8.0
|
49
|
+
- - <
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 0.9.0
|
39
52
|
- !ruby/object:Gem::Dependency
|
40
53
|
name: paperclip
|
41
|
-
requirement:
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
42
55
|
none: false
|
43
56
|
requirements:
|
44
57
|
- - ! '>='
|
@@ -46,10 +59,15 @@ dependencies:
|
|
46
59
|
version: '0'
|
47
60
|
type: :runtime
|
48
61
|
prerelease: false
|
49
|
-
version_requirements:
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
50
68
|
- !ruby/object:Gem::Dependency
|
51
69
|
name: mysql2
|
52
|
-
requirement:
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
53
71
|
none: false
|
54
72
|
requirements:
|
55
73
|
- - ! '>='
|
@@ -57,10 +75,15 @@ dependencies:
|
|
57
75
|
version: '0'
|
58
76
|
type: :development
|
59
77
|
prerelease: false
|
60
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
61
84
|
- !ruby/object:Gem::Dependency
|
62
85
|
name: rspec
|
63
|
-
requirement:
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
64
87
|
none: false
|
65
88
|
requirements:
|
66
89
|
- - ! '>='
|
@@ -68,10 +91,15 @@ dependencies:
|
|
68
91
|
version: '0'
|
69
92
|
type: :development
|
70
93
|
prerelease: false
|
71
|
-
version_requirements:
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
72
100
|
- !ruby/object:Gem::Dependency
|
73
101
|
name: rspec-rails
|
74
|
-
requirement:
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
75
103
|
none: false
|
76
104
|
requirements:
|
77
105
|
- - ! '>='
|
@@ -79,40 +107,60 @@ dependencies:
|
|
79
107
|
version: '0'
|
80
108
|
type: :development
|
81
109
|
prerelease: false
|
82
|
-
version_requirements:
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
83
116
|
- !ruby/object:Gem::Dependency
|
84
117
|
name: factory_girl
|
85
|
-
requirement:
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
86
119
|
none: false
|
87
120
|
requirements:
|
88
|
-
- - =
|
121
|
+
- - '='
|
89
122
|
- !ruby/object:Gem::Version
|
90
123
|
version: 2.5.0
|
91
124
|
type: :development
|
92
125
|
prerelease: false
|
93
|
-
version_requirements:
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.5.0
|
94
132
|
- !ruby/object:Gem::Dependency
|
95
133
|
name: mocha
|
96
|
-
requirement:
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
97
135
|
none: false
|
98
136
|
requirements:
|
99
|
-
- - =
|
137
|
+
- - '='
|
100
138
|
- !ruby/object:Gem::Version
|
101
139
|
version: 0.10.3
|
102
140
|
type: :development
|
103
141
|
prerelease: false
|
104
|
-
version_requirements:
|
142
|
+
version_requirements: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - '='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: 0.10.3
|
105
148
|
- !ruby/object:Gem::Dependency
|
106
149
|
name: database_cleaner
|
107
|
-
requirement:
|
150
|
+
requirement: !ruby/object:Gem::Requirement
|
108
151
|
none: false
|
109
152
|
requirements:
|
110
|
-
- - =
|
153
|
+
- - '='
|
111
154
|
- !ruby/object:Gem::Version
|
112
155
|
version: 0.7.1
|
113
156
|
type: :development
|
114
157
|
prerelease: false
|
115
|
-
version_requirements:
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - '='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: 0.7.1
|
116
164
|
description: Spud Media allows you to upload files to your site and manage them in
|
117
165
|
the spud administrative panel. It also uses paperclip and supports s3 storage
|
118
166
|
email:
|
@@ -214,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
262
|
version: '0'
|
215
263
|
segments:
|
216
264
|
- 0
|
217
|
-
hash:
|
265
|
+
hash: 3979225498801986740
|
218
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
267
|
none: false
|
220
268
|
requirements:
|
@@ -223,10 +271,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
271
|
version: '0'
|
224
272
|
segments:
|
225
273
|
- 0
|
226
|
-
hash:
|
274
|
+
hash: 3979225498801986740
|
227
275
|
requirements: []
|
228
276
|
rubyforge_project:
|
229
|
-
rubygems_version: 1.8.
|
277
|
+
rubygems_version: 1.8.24
|
230
278
|
signing_key:
|
231
279
|
specification_version: 3
|
232
280
|
summary: Spud File upload/management module
|