winton-captcha 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/captcha.gemspec +2 -2
- data/init.rb +1 -0
- data/lib/captcha/action.rb +3 -5
- data/lib/captcha/config.rb +8 -8
- metadata +2 -2
data/captcha.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'captcha'
|
3
|
-
s.version = '1.0.
|
4
|
-
s.date = '2009-03-
|
3
|
+
s.version = '1.0.6'
|
4
|
+
s.date = '2009-03-24'
|
5
5
|
|
6
6
|
s.summary = "An Rmagick based, Google-style captcha generator"
|
7
7
|
s.description = "An Rmagick based, Google-style captcha generator"
|
data/init.rb
CHANGED
data/lib/captcha/action.rb
CHANGED
@@ -20,11 +20,9 @@ module Captcha
|
|
20
20
|
|
21
21
|
def show
|
22
22
|
new and return unless session[:captcha]
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
:type => 'image/jpeg'
|
27
|
-
)
|
23
|
+
file = "#{Captcha::Config.options[:destination]}/#{session[:captcha]}.jpg"
|
24
|
+
new and return unless File.exists?(file)
|
25
|
+
send_file(file, :disposition => 'inline', :type => 'image/jpeg')
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
data/lib/captcha/config.rb
CHANGED
@@ -6,37 +6,37 @@ module Captcha
|
|
6
6
|
|
7
7
|
@@options = {
|
8
8
|
:colors => {
|
9
|
-
:background => '#
|
10
|
-
:font => '#
|
9
|
+
:background => '#FFFFFF',
|
10
|
+
:font => '#080288'
|
11
11
|
},
|
12
12
|
# number of captcha images to generate
|
13
13
|
:count => PRODUCTION ? 500 : 10,
|
14
14
|
:destination => "#{ROOT}public/images/captchas",
|
15
15
|
:dimensions => {
|
16
16
|
# canvas height (px)
|
17
|
-
:height =>
|
17
|
+
:height => 32,
|
18
18
|
# canvas width (px)
|
19
|
-
:width =>
|
19
|
+
:width => 110
|
20
20
|
},
|
21
21
|
:generate_every => PRODUCTION ? 24 * 60 * 60 : 10 ** 8,
|
22
22
|
# http://www.imagemagick.org/RMagick/doc/image2.html#implode
|
23
23
|
:implode => 0.2,
|
24
24
|
:letters => {
|
25
25
|
# text baseline (px)
|
26
|
-
:baseline =>
|
26
|
+
:baseline => 25,
|
27
27
|
# number of letters in captcha
|
28
28
|
:count => 6,
|
29
29
|
:ignore => ['a','e','i','o','u','l','j','q'],
|
30
30
|
# font size (pts)
|
31
|
-
:points =>
|
31
|
+
:points => 38,
|
32
32
|
# width of a character (used to decrease or increase space between characters) (px)
|
33
|
-
:width =>
|
33
|
+
:width => 17
|
34
34
|
},
|
35
35
|
:ttf => File.expand_path("#{File.dirname(__FILE__)}/../../resources/captcha.ttf"),
|
36
36
|
# http://www.imagemagick.org/RMagick/doc/image3.html#wave
|
37
37
|
:wave => {
|
38
38
|
# range is used for randomness (px)
|
39
|
-
:wavelength => (
|
39
|
+
:wavelength => (40..70),
|
40
40
|
# distance between peak and valley of sin wave (px)
|
41
41
|
:amplitude => 3
|
42
42
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winton-captcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winton Welsh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-24 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|