profilepic 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,62 @@
3
3
  # helpers
4
4
  # to generate
5
5
 
6
+ def radio_options_w_sprites( options,
7
+ name:,
8
+ legend: )
9
+
10
+ buf = <<TXT
11
+ <fieldset>
12
+ <legend>#{legend}:</legend>
13
+ TXT
14
+
15
+ options.each_with_index do |option,i|
16
+
17
+ value = option.downcase
18
+
19
+ ## auto-extract qualifiers e.g. (m)ale/(f)emale
20
+ qualifiers = if value.index( '(m)' ) then ['m']
21
+ elsif value.index( '(f)' ) then ['f']
22
+ elsif value.index( '(m/f)' ) then ['m', 'f']
23
+ else []
24
+ end
25
+
26
+ value = value.sub( '(m)', '' ).sub( '(f)', '' ).sub( '(m/f)', '' ).sub( '¹', '' )
27
+ value = value.strip
28
+
29
+
30
+
31
+ label = option
32
+
33
+ buf += <<TXT
34
+ <div>
35
+ <input type="radio" id="#{name}#{i}" name="#{name}" value="#{value}"
36
+ #{ i==0 ? 'checked' : '' }>
37
+ TXT
38
+
39
+ if ['none'].include?( value )
40
+ ## do nothing - no sprite(s) - for none & friends
41
+ elsif qualifiers.empty?
42
+ buf += %Q[ <span class="sprite" data-name="#{value}"></span>\n]
43
+ else
44
+ qualifiers.each do |qualifier|
45
+ buf += %Q[ <span class="sprite" data-name="#{value} (#{qualifier})"></span>\n]
46
+ end
47
+ end
48
+
49
+ buf += <<TXT
50
+ <label for="#{name}#{i}">#{label}</label>
51
+ </div>
52
+ TXT
53
+ end
54
+
55
+
56
+ buf += "</fieldset>\n"
57
+ buf
58
+
59
+ end
60
+
61
+
6
62
  def radio_options( options,
7
63
  name:,
8
64
  legend: )
@@ -15,12 +71,15 @@ TXT
15
71
  options.each_with_index do |option,i|
16
72
 
17
73
  value = option.downcase
74
+ value = value.sub( '(m)', '' ).sub( '(f)', '' ).sub( '(m/f)', '' ).sub( '¹', '' )
75
+ value = value.strip
76
+
18
77
  label = option
19
78
 
20
79
  buf += <<TXT
21
80
  <div>
22
81
  <input type="radio" id="#{name}#{i}" name="#{name}" value="#{value}"
23
- #{ i==0 ? 'checked' : '' }
82
+ #{ i==0 ? 'checked' : '' }>
24
83
  <label for="#{name}#{i}">#{label}</label>
25
84
  </div>
26
85
  TXT
@@ -31,6 +90,183 @@ buf
31
90
  end
32
91
 
33
92
 
93
+ YEOLDEPUNK_ARCHETYPE = [
94
+ 'Male 1',
95
+ 'Male 2',
96
+ 'Male 3',
97
+ 'Male 4',
98
+ 'Female 1',
99
+ 'Female 2',
100
+ 'Female 3',
101
+ 'Female 4',
102
+ 'Zombie',
103
+ 'Ape',
104
+ 'Alien',
105
+ ]
106
+
107
+
108
+ YEOLDEPUNK_HAIR = [
109
+ 'Shaved Head (m)',
110
+ 'Peak Spike (m)',
111
+ 'Vampire Hair (m)',
112
+ 'Purple Hair (m)',
113
+
114
+ 'Mohawk (m/f)',
115
+ 'Mohawk Dark (m/f)',
116
+ 'Mohawk Thin (m/f)',
117
+ 'Wild Hair (m/f)',
118
+ 'Crazy Hair (m/f)',
119
+ 'Messy Hair (m/f)',
120
+ 'Frumpy Hair (m/f)',
121
+ 'Stringy Hair (m/f)',
122
+ 'Clown Hair Green (m/f)',
123
+
124
+ 'Straight Hair (f)',
125
+ 'Straight Hair Dark (f)',
126
+ 'Straight Hair Blonde (f)',
127
+ 'Blonde Short (f)',
128
+ 'Blonde Bob (f)',
129
+ 'Wild Blonde (f)',
130
+ 'Wild White Hair (f)',
131
+ 'Orange Side (f)',
132
+ 'Dark Hair (f)',
133
+ 'Pigtails (f)',
134
+ 'Pink With Hat¹ (f)',
135
+ 'Half Shaved (f)',
136
+ 'Red Mohawk (f)',
137
+ ]
138
+
139
+ YEOLDEPUNK_BEARD = [
140
+ 'Shadow Beard (m)',
141
+ 'Normal Beard (m)',
142
+ 'Normal Beard Black (m)',
143
+ 'Big Beard (m)',
144
+ 'Luxurious Beard (m)',
145
+ 'Mustache (m)',
146
+ 'Goat (m)',
147
+ 'Handlebars (m)',
148
+ 'Front Beard (m)',
149
+ 'Front Beard Dark (m)',
150
+ 'Chinstrap (m)',
151
+ 'Muttonchops (m)',
152
+ ]
153
+
154
+ YEOLDEPUNK_EYEWEAR = [
155
+ 'Small Shades (m)',
156
+ 'Regular Shades (m/f)',
157
+ 'Classic Shades (m/f)',
158
+ 'Big Shades (m/f)',
159
+ 'Nerd Glasses (m/f)',
160
+ 'Horned Rim Glasses (m/f)',
161
+ '3D Glasses (m/f)',
162
+ 'VR (m/f)',
163
+ 'Eye Mask (m/f)',
164
+ 'Eye Patch (m/f)',
165
+ 'Welding Goggles (f)',
166
+ ]
167
+
168
+ YEOLDEPUNK_EARRING = [
169
+ 'Earring (m/f)'
170
+ ]
171
+
172
+
173
+ YEOLDEPUNK_HEADWEAR = [
174
+ 'Cowboy Hat (m)',
175
+ 'Fedora (m)',
176
+ 'Hoodie (m)',
177
+ 'Beanie (m)',
178
+ 'Top Hat (m)',
179
+ 'Do-rag (m)',
180
+ 'Police Cap (m)',
181
+ 'Cap Forward (m)',
182
+ 'Cap (m/f)',
183
+ 'Knitted Cap (m/f)',
184
+ 'Bandana (m/f)',
185
+ 'Headband¹ (m/f)',
186
+ 'Pilot Helmet (f)',
187
+ 'Tassle Hat (f)',
188
+ 'Tiara (f)',
189
+ ]
190
+
191
+ YEOLDEPUNK_EYES = [
192
+ 'Clown Eyes Green (m/f)',
193
+ 'Clown Eyes Blue (m/f)',
194
+ 'Green Eye Shadow (f)',
195
+ 'Blue Eye Shadow (f)',
196
+ 'Purple Eye Shadow (f)',
197
+ ]
198
+
199
+ YEOLDEPUNK_MOUTH = [
200
+ 'Smile (m)',
201
+ 'Frown (m)',
202
+ 'Buck Teeth (m)',
203
+ 'Hot Lipstick (f)',
204
+ 'Black Lipstick (f)',
205
+ 'Purple Lipstick (f)',
206
+ ]
207
+
208
+
209
+ YEOLDEPUNK_MOUTH_PROP = [
210
+ 'Cigarette (m/f)',
211
+ 'Vape (m/f)',
212
+ 'Pipe (m/f)',
213
+ 'Medical Mask (m/f)',
214
+ ]
215
+
216
+ YEOLDEPUNK_NECK = [
217
+ 'Silver Chain (m/f)',
218
+ 'Gold Chain (m/f)',
219
+ 'Choker (f)',
220
+ ]
221
+
222
+ YEOLDEPUNK_BLEMISH = [
223
+ 'Mole (m/f)',
224
+ 'Spots (m/f)',
225
+ 'Rosy Cheeks (m/f)',
226
+ ]
227
+
228
+ YEOLDEPUNK_NOSE = [
229
+ 'Clown Nose (m/f)',
230
+ ]
231
+
232
+
233
+
234
+
235
+ DOGE_ARCHETYPE = [
236
+ 'Classic',
237
+ 'Dark',
238
+ 'Zombie',
239
+ 'Alien',
240
+ ]
241
+
242
+ DOGE_HAIR = [
243
+ 'Crazy Hair',
244
+ ]
245
+
246
+ DOGE_HEADWEAR = [
247
+ 'Beanie',
248
+ 'Cap',
249
+ 'Cap Forward',
250
+ 'Cowboy Hat',
251
+ 'Fedora',
252
+ 'Knitted Cap',
253
+ 'Top Hat',
254
+ 'Bandana',
255
+ 'Headband',
256
+ 'Tiara',
257
+ ]
258
+
259
+ DOGE_EYEWEAR = [
260
+ '3D Glasses',
261
+ 'Big Shades',
262
+ 'Classic Shades',
263
+ 'Regular Shades',
264
+ 'Small Shades',
265
+ 'Nerd Glasses',
266
+ 'Eye Patch',
267
+ ]
268
+
269
+
34
270
 
35
271
  MARC_ARCHETYPE = [
36
272
  'Marc',
@@ -188,6 +424,16 @@ HTML
188
424
  erb :marcs
189
425
  end
190
426
 
427
+ get '/doge' do
428
+ erb :doge
429
+ end
430
+
431
+ get '/yeoldepunks' do
432
+ erb :yeoldepunks
433
+ end
434
+
435
+
436
+
191
437
 
192
438
  get '/generate_marcs' do
193
439
 
@@ -200,6 +446,29 @@ HTML
200
446
  redirect "/#{r.image_key}.png"
201
447
  end
202
448
 
449
+ get '/generate_yeoldepunks' do
450
+
451
+ r = ImageReq.build_yeoldepunk( params )
452
+
453
+ img = r.image
454
+
455
+ blob = img.image.to_blob
456
+ IMAGES[ r.image_key ] = blob
457
+ redirect "/#{r.image_key}.png"
458
+ end
459
+
460
+
461
+ get '/generate_doge' do
462
+
463
+ r = ImageReq.build_doge( params )
464
+
465
+ img = r.image
466
+
467
+ blob = img.image.to_blob
468
+ IMAGES[ r.image_key ] = blob
469
+ redirect "/#{r.image_key}.png"
470
+ end
471
+
203
472
 
204
473
  get '/generate' do
205
474
 
@@ -3,7 +3,7 @@
3
3
  module Profilepic
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- PATCH = 1
6
+ PATCH = 4
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
@@ -0,0 +1,74 @@
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_w_sprites( DOGE_ARCHETYPE,
20
+ name: 't',
21
+ legend: 'Select a doge shiba inu base (archetype)' ) %>
22
+
23
+ Options:
24
+
25
+ <%= radio_options_w_sprites( ['None']+DOGE_HAIR,
26
+ name: 'hair',
27
+ legend: 'Select hair' ) %>
28
+
29
+ <%= radio_options_w_sprites( ['None']+DOGE_HEADWEAR,
30
+ name: 'headwear',
31
+ legend: 'Select headwear' ) %>
32
+
33
+
34
+ <%= radio_options_w_sprites( ['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
+ <%= erb :'shared/_more_options' %>
45
+
46
+ </form>
47
+
48
+
49
+ <script>
50
+ var sheet = Spritesheet.read( 'doge-24x24.png',
51
+ `0, classic
52
+ 1, dark
53
+ 2, zombie
54
+ 3, alien
55
+ 4, crazyhair
56
+ 5, beanie
57
+ 6, cap
58
+ 7, capforward
59
+ 8, cowboyhat
60
+ 9, fedora
61
+ 10, knittedcap
62
+ 11, tophat
63
+ 12, bandana
64
+ 13, headband
65
+ 14, tiara
66
+ 15, 3dglasses
67
+ 16, bigshades
68
+ 17, classicshades
69
+ 18, regularshades
70
+ 19, smallshades
71
+ 20, nerdglasses
72
+ 21, eyepatch` );
73
+ sheet.draw();
74
+ </script>
@@ -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,21 @@ own 100% forever.
41
41
  <label for="t5">Saudi Sheik (24×24)</label>
42
42
  </div>
43
43
 
44
- <div>
45
- <input type="radio" id="t6" name="t" value="yeoldepunk">
46
- <label for="t6">Matt &amp; John's® Ye Olde' Punk V1/V2 (Anno 2017) (24×24)</label>
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 &amp; John's® Ye Olde' Punk V1/V2 (Anno 2017) (24×24)</label>
54
+ ... or try the <b><a href="/yeoldepunks">Matt &amp; John's® Ye Olde' Punk V1/V2 (Anno 2017) Wizard »</a></b>
55
+
56
+ </div>
57
+
58
+
48
59
  </fieldset>
49
60
 
50
61
 
@@ -6,6 +6,7 @@
6
6
  <title>Profile Pic(ture) As A Service</title>
7
7
 
8
8
  <link href="<%= url('/style.css') %>" rel='stylesheet'>
9
+ <script src="spritesheet.js"></script>
9
10
  </head>
10
11
  <body>
11
12
 
@@ -1,5 +1,9 @@
1
+ <p style="font-size: 80%;">
2
+ <a href="/">« Profile Pic(ture) As A Service</a>
3
+ </p>
4
+
1
5
 
2
- <h1>Marcs (24×24) - Profile Pic(ture) As Service</h1>
6
+ <h1>Design Your Own Marc (24×24) Wizard</h1>
3
7
 
4
8
  <p>Yes, you can!
5
9
  Generate your own originals that you
@@ -11,39 +15,39 @@ own 100% forever.
11
15
  <form action="/generate_marcs" method="get" id="form1">
12
16
 
13
17
 
14
- <%= radio_options( MARC_ARCHETYPE,
18
+ <%= radio_options_w_sprites( MARC_ARCHETYPE,
15
19
  name: 't',
16
20
  legend: 'Select a marc base (archetype)' ) %>
17
21
 
18
22
  Options:
19
23
 
20
24
 
21
- <%= radio_options( ['None']+MARC_EYES,
25
+ <%= radio_options_w_sprites( ['None']+MARC_EYES,
22
26
  name: 'eyes',
23
27
  legend: 'Select eyes (extras)' ) %>
24
28
 
25
- <%= radio_options( ['None']+MARC_FACE,
29
+ <%= radio_options_w_sprites( ['None']+MARC_FACE,
26
30
  name: 'face',
27
31
  legend: 'Select face (extras)' ) %>
28
32
 
29
- <%= radio_options( ['None']+MARC_BEARD,
33
+ <%= radio_options_w_sprites( ['None']+MARC_BEARD,
30
34
  name: 'beard',
31
35
  legend: 'Select beard' ) %>
32
36
 
33
- <%= radio_options( ['None']+MARC_HAIR,
37
+ <%= radio_options_w_sprites( ['None']+MARC_HAIR,
34
38
  name: 'hair',
35
39
  legend: 'Select hair' ) %>
36
40
 
37
- <%= radio_options( ['None']+MARC_HEADWEAR,
41
+ <%= radio_options_w_sprites( ['None']+MARC_HEADWEAR,
38
42
  name: 'headwear',
39
43
  legend: 'Select headwear' ) %>
40
44
 
41
45
 
42
- <%= radio_options( ['None']+MARC_EYEWEAR,
46
+ <%= radio_options_w_sprites( ['None']+MARC_EYEWEAR,
43
47
  name: 'eyewear',
44
48
  legend: 'Select eyewear' ) %>
45
49
 
46
- <%= radio_options( ['None']+MARC_MOUTH_PROP,
50
+ <%= radio_options_w_sprites( ['None']+MARC_MOUTH_PROP,
47
51
  name: 'mouth',
48
52
  legend: 'Select mouth prop' ) %>
49
53
 
@@ -53,32 +57,162 @@ Options:
53
57
  style="font-size: 400%; color: white; background-color: blue;">Generate Profile Pic(ture) in .PNG Format</button>
54
58
  </div>
55
59
 
60
+ <%= erb :'shared/_more_options' %>
56
61
 
62
+ </form>
57
63
 
58
- Or
59
-
60
- <fieldset>
61
- <legend>Type (more) attribute description / specification:</legend>
62
-
63
- <div>
64
- <input type="text" id="attributes" name="attributes"
65
- minlength="0" maxlength="200" size="80"
66
- style="font-size: 200%;"
67
- placeholder="Attribute 1, Attribute 2, Attribute 3, ...">
68
-
69
- <p>
70
- Examples:
71
- </p>
72
- <ul>
73
- <li>Normal Beard, Big Shades</li>
74
- <li>Crazy Hair, 3D Glasses</li>
75
- <li>Headband</li>
76
- </ul>
77
-
78
- </div>
79
- </fieldset>
80
64
 
81
65
 
82
- <%= erb :'shared/_more_options' %>
83
66
 
84
- </form>
67
+ <script>
68
+ var sheet = Spritesheet.read( 'marcs-24x24.png',
69
+ `0, marc classic
70
+ 1, ape classic
71
+ 2, Marc Dark
72
+ 3, Marc Mid
73
+ 4, Marc
74
+ 5, Marc Albino
75
+ 6, Marc Golden
76
+ 7, madlad
77
+ 8, zombie
78
+ 9, ape
79
+ 10, Ape Golden
80
+ 11, Ape Pink
81
+ 12, Alien
82
+ 13, Alien Green
83
+ 14, Devil
84
+ 15, Devil 2
85
+ 16, Devil 3
86
+ 17, orc
87
+ 18, skeleton
88
+ 19, bot
89
+ 20, blue_eyes
90
+ 21, green_eyes
91
+ 22, blue_eye_shadow
92
+ 23, green_eye_shadow
93
+ 24, purple_eye_shadow
94
+ 25, bagner
95
+ 26, horns
96
+ 27, marc_tyson
97
+ 28, cleft
98
+ 29, mole
99
+ 30, rosy_cheeks
100
+ 31, shine
101
+ 32, spots
102
+ 33, black_lipstick
103
+ 34, hot_lipstick
104
+ 35, purple_lipstick
105
+ 36, buck_teeth
106
+ 37, clown_nose
107
+ 38, gold_ring
108
+ 39, diamond_earring
109
+ 40, gold_earring
110
+ 41, diamond_helix
111
+ 42, gold_helix
112
+ 43, frown
113
+ 44, smile
114
+ 45, big_beard_white
115
+ 46, big_beard
116
+ 47, chinstrap
117
+ 48, front_beard
118
+ 49, front_beard_dark
119
+ 50, full_mustache
120
+ 51, full_mustache_dark
121
+ 52, goat
122
+ 53, goat_dark
123
+ 54, handlebar
124
+ 55, luxurious_beard
125
+ 56, mustache
126
+ 57, mutton_chop
127
+ 58, normal_beard
128
+ 59, normal_beard_black
129
+ 60, shadow_beard
130
+ 61, soul_patch
131
+ 62, bandana
132
+ 63, beanie
133
+ 64, bunny_ears
134
+ 65, cap
135
+ 66, skull_cap
136
+ 67, cap_forward
137
+ 68, police_cap
138
+ 69, cowboy_hat
139
+ 70, do_rag
140
+ 71, fast_food
141
+ 72, marcdonalds
142
+ 73, fedora
143
+ 74, headband
144
+ 75, roaring_headband
145
+ 76, hoodie
146
+ 77, purple_hoodie
147
+ 78, knitted_cap
148
+ 79, laurels
149
+ 80, shemagh
150
+ 81, tassle_hat
151
+ 82, tiarra
152
+ 83, top_hat
153
+ 84, uncle_sam
154
+ 85, viking
155
+ 86, welding_goggles
156
+ 87, blonde_bob
157
+ 88, chad
158
+ 89, clown_hair
159
+ 90, crazy_white_hair
160
+ 91, crazy_hair
161
+ 92, frumpy_hair
162
+ 93, marc_three
163
+ 94, purple_hair
164
+ 95, stringy_hair
165
+ 96, vampire_hair
166
+ 97, wild_blonde_hair
167
+ 98, wild_hair
168
+ 99, clown_eyes_blue
169
+ 100, clown_eyes_green
170
+ 101, lasers
171
+ 102, tears
172
+ 103, 3d_glasses
173
+ 104, aviators
174
+ 105, big_shades
175
+ 106, classic_shades
176
+ 107, deal_with_it
177
+ 108, glasses
178
+ 109, gold_glasses
179
+ 110, horned_rim_glasses
180
+ 111, monocle
181
+ 112, nerd_glasses
182
+ 113, pink_shades
183
+ 114, polarized
184
+ 115, polarized_white
185
+ 116, regular_shades
186
+ 117, small_shades
187
+ 118, VR Headset
188
+ 119, eye_mask
189
+ 120, eye_patch
190
+ 121, cigar
191
+ 122, cigarette
192
+ 123, hookah
193
+ 124, pipe
194
+ 125, vape
195
+ 126, medical_mask
196
+ 127, bubble_gum
197
+ 128, black_tie
198
+ 129, blue_tie
199
+ 130, red_tie
200
+ 131, blue_shirt
201
+ 132, blue_t_shirt
202
+ 133, Fast Food Shirt
203
+ 134, green_shirt
204
+ 135, grey_shirt
205
+ 136, purple_t_shirt
206
+ 137, white_t_shirt
207
+ 138, jumpsuit
208
+ 139, labcoat
209
+ 140, choker
210
+ 141, double_gold_chain
211
+ 142, gold_chain
212
+ 143, silver_chain
213
+ 144, thick_chain
214
+ 145, hemp
215
+ 146, ice
216
+ 147, medallion` );
217
+ sheet.draw();
218
+ </script>