profilepic 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/lib/profilepic/builder.rb +43 -13
- data/lib/profilepic/service.rb +51 -0
- data/lib/profilepic/version.rb +1 -1
- data/lib/profilepic/views/doge.erb +70 -0
- data/lib/profilepic/views/index.erb +13 -4
- data/lib/profilepic/views/marcs.erb +5 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4cb3b184f5c14e2e509c873de59631a56687492ea6dc3a20c33c9dd261ca9c1
|
4
|
+
data.tar.gz: 85204077ae0502dd27e3ccaa15fa94f2afe539c2bad6e0f23f8602b053be6732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85dacbe04ffc88a2e0b72197d48c4f33c4019926ae76eddaa523ca898b86442bdb0d7ba3d96ae18f43a57792b1a4132614fb0518fa91d051c5074b124b370b4d
|
7
|
+
data.tar.gz: 0a0f9eefccd51a8d367482a26dd1fc335c1041d1a073aafb14c71e0262fd570f68188f734d00755c2579806a6c30b18d3fe8b871227a9d23200facab299f124b
|
data/Manifest.txt
CHANGED
data/lib/profilepic/builder.rb
CHANGED
@@ -56,25 +56,34 @@ class ImageReq ## (Generate) Image Request
|
|
56
56
|
background: background )
|
57
57
|
end
|
58
58
|
|
59
|
+
def self.build_doge( params )
|
60
|
+
puts "==> image request params:"
|
61
|
+
pp params
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
+
name = 'doge'
|
64
|
+
archetype = _norm_key( params[:t] || 'classic' )
|
65
|
+
more_attributes = _parse_attributes( params[:attributes] || '' )
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
attributes = str.split( %r{[,;|+/]+} )
|
68
|
-
attributes = attributes.map { |attr| attr.strip }
|
69
|
-
attributes = attributes.select { |attr| !attr.empty?} ## remove empty strings (if any)
|
70
|
-
attributes
|
71
|
-
end
|
67
|
+
hair = _norm_key( params[:hair] || 'none' )
|
68
|
+
headwear = _norm_key( params[:headwear] || 'none' )
|
69
|
+
eyewear = _norm_key( params[:eyewear] || 'none' )
|
72
70
|
|
73
|
-
|
74
|
-
|
71
|
+
zoom = _parse_zoom( params[:z] || '1' )
|
72
|
+
background = _norm_key( params[:bg] || 'none' )
|
73
|
+
|
74
|
+
attributes = [archetype]
|
75
|
+
attributes << hair if hair != 'none'
|
76
|
+
attributes << headwear if headwear != 'none'
|
77
|
+
attributes << eyewear if eyewear != 'none'
|
78
|
+
|
79
|
+
new( name: name,
|
80
|
+
attributes: attributes + more_attributes,
|
81
|
+
zoom: zoom,
|
82
|
+
background: background )
|
75
83
|
end
|
76
84
|
|
77
85
|
|
86
|
+
|
78
87
|
attr_reader :name,
|
79
88
|
:attributes,
|
80
89
|
:zoom,
|
@@ -101,5 +110,26 @@ class ImageReq ## (Generate) Image Request
|
|
101
110
|
end
|
102
111
|
@key
|
103
112
|
end
|
113
|
+
|
114
|
+
#####
|
115
|
+
# (static) helpers
|
116
|
+
|
117
|
+
def self._norm_key( str )
|
118
|
+
str.downcase.strip
|
119
|
+
end
|
120
|
+
|
121
|
+
def self._parse_attributes( str )
|
122
|
+
# convert attributes to array
|
123
|
+
## allow various separators
|
124
|
+
attributes = str.split( %r{[,;|+/]+} )
|
125
|
+
attributes = attributes.map { |attr| attr.strip }
|
126
|
+
attributes = attributes.select { |attr| !attr.empty?} ## remove empty strings (if any)
|
127
|
+
attributes
|
128
|
+
end
|
129
|
+
|
130
|
+
def self._parse_zoom( str )
|
131
|
+
str.strip.to_i( 10 )
|
132
|
+
end
|
133
|
+
|
104
134
|
end
|
105
135
|
|
data/lib/profilepic/service.rb
CHANGED
@@ -31,6 +31,41 @@ buf
|
|
31
31
|
end
|
32
32
|
|
33
33
|
|
34
|
+
DOGE_ARCHETYPE = [
|
35
|
+
'Classic',
|
36
|
+
'Dark',
|
37
|
+
'Zombie',
|
38
|
+
'Alien',
|
39
|
+
]
|
40
|
+
|
41
|
+
DOGE_HAIR = [
|
42
|
+
'Crazy Hair',
|
43
|
+
]
|
44
|
+
|
45
|
+
DOGE_HEADWEAR = [
|
46
|
+
'Beanie',
|
47
|
+
'Cap',
|
48
|
+
'Cap Forward',
|
49
|
+
'Cowboy Hat',
|
50
|
+
'Fedora',
|
51
|
+
'Knitted Cap',
|
52
|
+
'Top Hat',
|
53
|
+
'Bandana',
|
54
|
+
'Headband',
|
55
|
+
'Tiara',
|
56
|
+
]
|
57
|
+
|
58
|
+
DOGE_EYEWEAR = [
|
59
|
+
'3D Glasses',
|
60
|
+
'Big Shades',
|
61
|
+
'Classic Shades',
|
62
|
+
'Regular Shades',
|
63
|
+
'Small Shades',
|
64
|
+
'Nerd Glasses',
|
65
|
+
'Eye Patch',
|
66
|
+
]
|
67
|
+
|
68
|
+
|
34
69
|
|
35
70
|
MARC_ARCHETYPE = [
|
36
71
|
'Marc',
|
@@ -188,6 +223,10 @@ HTML
|
|
188
223
|
erb :marcs
|
189
224
|
end
|
190
225
|
|
226
|
+
get '/doge' do
|
227
|
+
erb :doge
|
228
|
+
end
|
229
|
+
|
191
230
|
|
192
231
|
get '/generate_marcs' do
|
193
232
|
|
@@ -201,6 +240,18 @@ HTML
|
|
201
240
|
end
|
202
241
|
|
203
242
|
|
243
|
+
get '/generate_doge' do
|
244
|
+
|
245
|
+
r = ImageReq.build_doge( params )
|
246
|
+
|
247
|
+
img = r.image
|
248
|
+
|
249
|
+
blob = img.image.to_blob
|
250
|
+
IMAGES[ r.image_key ] = blob
|
251
|
+
redirect "/#{r.image_key}.png"
|
252
|
+
end
|
253
|
+
|
254
|
+
|
204
255
|
get '/generate' do
|
205
256
|
|
206
257
|
r = ImageReq.build( params )
|
data/lib/profilepic/version.rb
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
<p style="font-size: 80%;">
|
2
|
+
<a href="/">« Profile Pic(ture) As A Service</a>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
<h1>Design Your Own Doge Shiba Inu (24×24) Wizard</h1>
|
8
|
+
|
9
|
+
<p>Yes, you can!
|
10
|
+
Generate your own originals that you
|
11
|
+
own 100% forever.
|
12
|
+
</p>
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
<form action="/generate_doge" method="get" id="form1">
|
17
|
+
|
18
|
+
|
19
|
+
<%= radio_options( DOGE_ARCHETYPE,
|
20
|
+
name: 't',
|
21
|
+
legend: 'Select a doge shiba inu base (archetype)' ) %>
|
22
|
+
|
23
|
+
Options:
|
24
|
+
|
25
|
+
<%= radio_options( ['None']+DOGE_HAIR,
|
26
|
+
name: 'hair',
|
27
|
+
legend: 'Select hair' ) %>
|
28
|
+
|
29
|
+
<%= radio_options( ['None']+DOGE_HEADWEAR,
|
30
|
+
name: 'headwear',
|
31
|
+
legend: 'Select headwear' ) %>
|
32
|
+
|
33
|
+
|
34
|
+
<%= radio_options( ['None']+DOGE_EYEWEAR,
|
35
|
+
name: 'eyewear',
|
36
|
+
legend: 'Select eyewear' ) %>
|
37
|
+
|
38
|
+
<div>
|
39
|
+
<button type="submit" form="form1" value="Submit"
|
40
|
+
style="font-size: 400%; color: white; background-color: blue;">Generate Profile Pic(ture) in .PNG Format</button>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
Or
|
46
|
+
|
47
|
+
<fieldset>
|
48
|
+
<legend>Type (more) attribute description / specification:</legend>
|
49
|
+
|
50
|
+
<div>
|
51
|
+
<input type="text" id="attributes" name="attributes"
|
52
|
+
minlength="0" maxlength="200" size="80"
|
53
|
+
style="font-size: 200%;"
|
54
|
+
placeholder="Attribute 1, Attribute 2, Attribute 3, ...">
|
55
|
+
|
56
|
+
<p>
|
57
|
+
Examples:
|
58
|
+
</p>
|
59
|
+
<ul>
|
60
|
+
<li>Crazy Hair, 3D Glasses</li>
|
61
|
+
<li>Headband</li>
|
62
|
+
</ul>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
</fieldset>
|
66
|
+
|
67
|
+
|
68
|
+
<%= erb :'shared/_more_options' %>
|
69
|
+
|
70
|
+
</form>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
<h1>Profile Pic(ture) As Service</h1>
|
3
|
+
<h1>Profile Pic(ture) As A Service</h1>
|
4
4
|
|
5
5
|
<p>Yes, you can!
|
6
6
|
Generate your own originals that you
|
@@ -41,10 +41,19 @@ own 100% forever.
|
|
41
41
|
<label for="t5">Saudi Sheik (24×24)</label>
|
42
42
|
</div>
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
<
|
44
|
+
|
45
|
+
<div>
|
46
|
+
<input type="radio" id="t7" name="t" value="doge">
|
47
|
+
<label for="t7">Doge Shiba Inu (24×24)</label>
|
48
|
+
... or try the <b><a href="/doge">Design Your Own Doge Shiba Inu Wizard »</a></b>
|
47
49
|
</div>
|
50
|
+
|
51
|
+
<div>
|
52
|
+
<input type="radio" id="t6" name="t" value="yeoldepunk">
|
53
|
+
<label for="t6">Matt & John's® Ye Olde' Punk V1/V2 (Anno 2017) (24×24)</label>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
48
57
|
</fieldset>
|
49
58
|
|
50
59
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: profilepic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/profilepic/public/style.css
|
107
107
|
- lib/profilepic/service.rb
|
108
108
|
- lib/profilepic/version.rb
|
109
|
+
- lib/profilepic/views/doge.erb
|
109
110
|
- lib/profilepic/views/index.erb
|
110
111
|
- lib/profilepic/views/layout.erb
|
111
112
|
- lib/profilepic/views/marcs.erb
|