profilepic 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +5 -0
- data/lib/profilepic/builder.rb +177 -0
- data/lib/profilepic/public/style.css +2 -2
- data/lib/profilepic/service.rb +423 -40
- data/lib/profilepic/version.rb +1 -1
- data/lib/profilepic/views/doge.erb +70 -0
- data/lib/profilepic/views/index.erb +17 -52
- data/lib/profilepic/views/marcs.erb +88 -0
- data/lib/profilepic/views/shared/_more_options.erb +49 -0
- data/lib/profilepic/views/yeoldepunks.erb +91 -0
- data/lib/profilepic.rb +1 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ffc9a8e667f60136de35f02afcf76ffe1726b987630b06e5476f8319fc1389c
|
4
|
+
data.tar.gz: 35358297cc5182a6af8a7b83d1abdbfa9826e16f2dd5a20937e4162f1961042e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35f8b682f2fe4985c47a5e34d3f1b711b4657e137bc324635b79e16e7fb7a63381dfc6f352f24ecf5236f821aedf0457357bf47a8fc1719f30d2359e563062d5
|
7
|
+
data.tar.gz: 36f6275b5c5fee241f489dc7f19206d786fe4204611a0bea83ff77c232ef77fc8cce0b9913b1e9799a3f96df4f041e338636f0e777bdd493397803ec08e3c2dd
|
data/Manifest.txt
CHANGED
@@ -4,9 +4,14 @@ README.md
|
|
4
4
|
Rakefile
|
5
5
|
bin/profilepic
|
6
6
|
lib/profilepic.rb
|
7
|
+
lib/profilepic/builder.rb
|
7
8
|
lib/profilepic/public/style.css
|
8
9
|
lib/profilepic/service.rb
|
9
10
|
lib/profilepic/version.rb
|
11
|
+
lib/profilepic/views/doge.erb
|
10
12
|
lib/profilepic/views/index.erb
|
11
13
|
lib/profilepic/views/layout.erb
|
14
|
+
lib/profilepic/views/marcs.erb
|
15
|
+
lib/profilepic/views/shared/_more_options.erb
|
12
16
|
lib/profilepic/views/shared/_version.erb
|
17
|
+
lib/profilepic/views/yeoldepunks.erb
|
@@ -0,0 +1,177 @@
|
|
1
|
+
|
2
|
+
## keep cache of generated images (profile pics)
|
3
|
+
IMAGES = {}
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
class ImageReq ## (Generate) Image Request
|
9
|
+
def self.build( params )
|
10
|
+
puts "==> image request params:"
|
11
|
+
pp params
|
12
|
+
|
13
|
+
name = _norm_key( params[:t] || 'punk' )
|
14
|
+
attributes = _parse_attributes( params[:attributes] || '' )
|
15
|
+
|
16
|
+
zoom = _parse_zoom( params[:z] || '1' )
|
17
|
+
background = _norm_key( params[:bg] || 'none' )
|
18
|
+
|
19
|
+
new( name: name,
|
20
|
+
attributes: attributes,
|
21
|
+
zoom: zoom,
|
22
|
+
background: background )
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.build_marc( params )
|
26
|
+
puts "==> image request params:"
|
27
|
+
pp params
|
28
|
+
|
29
|
+
name = 'marc'
|
30
|
+
archetype = _norm_key( params[:t] || 'marc' )
|
31
|
+
more_attributes = _parse_attributes( params[:attributes] || '' )
|
32
|
+
|
33
|
+
eyes = _norm_key( params[:eyes] || 'none' )
|
34
|
+
face = _norm_key( params[:face] || 'none' )
|
35
|
+
beard = _norm_key( params[:beard] || 'none' )
|
36
|
+
hair = _norm_key( params[:hair] || 'none' )
|
37
|
+
headwear = _norm_key( params[:headwear] || 'none' )
|
38
|
+
eyewear = _norm_key( params[:eyewear] || 'none' )
|
39
|
+
mouth = _norm_key( params[:mouth] || 'none' )
|
40
|
+
|
41
|
+
zoom = _parse_zoom( params[:z] || '1' )
|
42
|
+
background = _norm_key( params[:bg] || 'none' )
|
43
|
+
|
44
|
+
attributes = [archetype]
|
45
|
+
attributes << eyes if eyes != 'none'
|
46
|
+
attributes << face if face != 'none'
|
47
|
+
attributes << hair if hair != 'none'
|
48
|
+
attributes << beard if beard != 'none'
|
49
|
+
attributes << headwear if headwear != 'none'
|
50
|
+
attributes << eyewear if eyewear != 'none'
|
51
|
+
attributes << mouth if mouth != 'none'
|
52
|
+
|
53
|
+
new( name: name,
|
54
|
+
attributes: attributes + more_attributes,
|
55
|
+
zoom: zoom,
|
56
|
+
background: background )
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.build_doge( params )
|
60
|
+
puts "==> image request params:"
|
61
|
+
pp params
|
62
|
+
|
63
|
+
name = 'doge'
|
64
|
+
archetype = _norm_key( params[:t] || 'classic' )
|
65
|
+
more_attributes = _parse_attributes( params[:attributes] || '' )
|
66
|
+
|
67
|
+
hair = _norm_key( params[:hair] || 'none' )
|
68
|
+
headwear = _norm_key( params[:headwear] || 'none' )
|
69
|
+
eyewear = _norm_key( params[:eyewear] || 'none' )
|
70
|
+
|
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 )
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
def self.build_yeoldepunk( params )
|
87
|
+
puts "==> image request params:"
|
88
|
+
pp params
|
89
|
+
|
90
|
+
name = 'yeoldepunk'
|
91
|
+
archetype = _norm_key( params[:t] || 'male 3' )
|
92
|
+
|
93
|
+
hair = _norm_key( params[:hair] || 'none' )
|
94
|
+
beard = _norm_key( params[:beard] || 'none' )
|
95
|
+
eyes = _norm_key( params[:eyes] || 'none' )
|
96
|
+
eyewear = _norm_key( params[:eyewear] || 'none' )
|
97
|
+
blemish = _norm_key( params[:blemish] || 'none' )
|
98
|
+
nose = _norm_key( params[:nose] || 'none' )
|
99
|
+
mouth = _norm_key( params[:mouth] || 'none' )
|
100
|
+
mouthprop = _norm_key( params[:mouthprop] || 'none' )
|
101
|
+
earring = _norm_key( params[:earring] || 'none' )
|
102
|
+
headwear = _norm_key( params[:headwear] || 'none' )
|
103
|
+
neck = _norm_key( params[:neck] || 'none' )
|
104
|
+
|
105
|
+
zoom = _parse_zoom( params[:z] || '1' )
|
106
|
+
background = _norm_key( params[:bg] || 'none' )
|
107
|
+
|
108
|
+
attributes = [archetype]
|
109
|
+
attributes << hair if hair != 'none'
|
110
|
+
attributes << blemish if blemish != 'none'
|
111
|
+
attributes << beard if beard != 'none'
|
112
|
+
attributes << eyes if eyes != 'none'
|
113
|
+
attributes << eyewear if eyewear != 'none'
|
114
|
+
attributes << nose if nose != 'none'
|
115
|
+
attributes << mouth if mouth != 'none'
|
116
|
+
attributes << mouthprop if mouthprop != 'none'
|
117
|
+
attributes << earring if earring != 'none'
|
118
|
+
attributes << headwear if headwear != 'none'
|
119
|
+
attributes << neck if neck != 'none'
|
120
|
+
|
121
|
+
new( name: name,
|
122
|
+
attributes: attributes,
|
123
|
+
zoom: zoom,
|
124
|
+
background: background )
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
attr_reader :name,
|
130
|
+
:attributes,
|
131
|
+
:zoom,
|
132
|
+
:background
|
133
|
+
def initialize( name:, attributes:, zoom:, background: )
|
134
|
+
@name = name
|
135
|
+
@attributes = attributes
|
136
|
+
@zoom = zoom
|
137
|
+
@background = background
|
138
|
+
end
|
139
|
+
|
140
|
+
def image
|
141
|
+
img = Original::Image.fabricate( @name, *@attributes )
|
142
|
+
img = img.background( @background ) if @background != 'none'
|
143
|
+
img = img.zoom( @zoom ) if [2,3,4,5,6,7,8,9,10,20].include?( @zoom )
|
144
|
+
img
|
145
|
+
end
|
146
|
+
|
147
|
+
def image_key
|
148
|
+
@key ||= begin
|
149
|
+
key = "#{@name}#{Time.now.to_i}"
|
150
|
+
key << "@#{@zoom}x" if [2,3,4,5,6,7,8,9,10,20].include?( @zoom )
|
151
|
+
key
|
152
|
+
end
|
153
|
+
@key
|
154
|
+
end
|
155
|
+
|
156
|
+
#####
|
157
|
+
# (static) helpers
|
158
|
+
|
159
|
+
def self._norm_key( str )
|
160
|
+
str.downcase.strip
|
161
|
+
end
|
162
|
+
|
163
|
+
def self._parse_attributes( str )
|
164
|
+
# convert attributes to array
|
165
|
+
## allow various separators
|
166
|
+
attributes = str.split( %r{[,;|+/]+} )
|
167
|
+
attributes = attributes.map { |attr| attr.strip }
|
168
|
+
attributes = attributes.select { |attr| !attr.empty?} ## remove empty strings (if any)
|
169
|
+
attributes
|
170
|
+
end
|
171
|
+
|
172
|
+
def self._parse_zoom( str )
|
173
|
+
str.strip.to_i( 10 )
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
data/lib/profilepic/service.rb
CHANGED
@@ -1,57 +1,440 @@
|
|
1
|
+
|
2
|
+
###
|
3
|
+
# helpers
|
4
|
+
# to generate
|
5
|
+
|
6
|
+
def radio_options( 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
|
+
value = value.sub( '(m)', '' ).sub( '(f)', '' ).sub( '(m/f)', '' ).sub( '¹', '' )
|
19
|
+
label = option
|
20
|
+
|
21
|
+
buf += <<TXT
|
22
|
+
<div>
|
23
|
+
<input type="radio" id="#{name}#{i}" name="#{name}" value="#{value}"
|
24
|
+
#{ i==0 ? 'checked' : '' }
|
25
|
+
<label for="#{name}#{i}">#{label}</label>
|
26
|
+
</div>
|
27
|
+
TXT
|
28
|
+
end
|
29
|
+
|
30
|
+
buf += "</fieldset>\n"
|
31
|
+
buf
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
YEOLDEPUNK_ARCHETYPE = [
|
36
|
+
'Male 1',
|
37
|
+
'Male 2',
|
38
|
+
'Male 3',
|
39
|
+
'Male 4',
|
40
|
+
'Female 1',
|
41
|
+
'Female 2',
|
42
|
+
'Female 3',
|
43
|
+
'Female 4',
|
44
|
+
'Zombie',
|
45
|
+
'Ape',
|
46
|
+
'Alien',
|
47
|
+
]
|
48
|
+
|
49
|
+
|
50
|
+
YEOLDEPUNK_HAIR = [
|
51
|
+
'Shaved Head (m)',
|
52
|
+
'Peak Spike (m)',
|
53
|
+
'Vampire Hair (m)',
|
54
|
+
'Purple Hair (m)',
|
55
|
+
|
56
|
+
'Mohawk (m/f)',
|
57
|
+
'Mohawk Dark (m/f)',
|
58
|
+
'Mohawk Thin (m/f)',
|
59
|
+
'Wild Hair (m/f)',
|
60
|
+
'Crazy Hair (m/f)',
|
61
|
+
'Messy Hair (m/f)',
|
62
|
+
'Frumpy Hair (m/f)',
|
63
|
+
'Stringy Hair (m/f)',
|
64
|
+
'Clown Hair Green (m/f)',
|
65
|
+
|
66
|
+
'Straight Hair (f)',
|
67
|
+
'Straight Hair Dark (f)',
|
68
|
+
'Straight Hair Blonde (f)',
|
69
|
+
'Blonde Short (f)',
|
70
|
+
'Blonde Bob (f)',
|
71
|
+
'Wild Blonde (f)',
|
72
|
+
'Wild White Hair (f)',
|
73
|
+
'Orange Side (f)',
|
74
|
+
'Dark Hair (f)',
|
75
|
+
'Pigtails (f)',
|
76
|
+
'Pink With Hat¹ (f)',
|
77
|
+
'Half Shaved (f)',
|
78
|
+
'Red Mohawk (f)',
|
79
|
+
]
|
80
|
+
|
81
|
+
YEOLDEPUNK_BEARD = [
|
82
|
+
'Shadow Beard (m)',
|
83
|
+
'Normal Beard (m)',
|
84
|
+
'Normal Beard Black (m)',
|
85
|
+
'Big Beard (m)',
|
86
|
+
'Luxurious Beard (m)',
|
87
|
+
'Mustache (m)',
|
88
|
+
'Goat (m)',
|
89
|
+
'Handlebars (m)',
|
90
|
+
'Front Beard (m)',
|
91
|
+
'Front Beard Dark (m)',
|
92
|
+
'Chinstrap (m)',
|
93
|
+
'Muttonchops (m)',
|
94
|
+
]
|
95
|
+
|
96
|
+
YEOLDEPUNK_EYEWEAR = [
|
97
|
+
'Small Shades (m)',
|
98
|
+
'Regular Shades (m/f)',
|
99
|
+
'Classic Shades (m/f)',
|
100
|
+
'Big Shades (m/f)',
|
101
|
+
'Nerd Glasses (m/f)',
|
102
|
+
'Horned Rim Glasses (m/f)',
|
103
|
+
'3D Glasses (m/f)',
|
104
|
+
'VR (m/f)',
|
105
|
+
'Eye Mask (m/f)',
|
106
|
+
'Eye Patch (m/f)',
|
107
|
+
'Welding Goggles (f)',
|
108
|
+
]
|
109
|
+
|
110
|
+
YEOLDEPUNK_EARRING = [
|
111
|
+
'Earring (m/f)'
|
112
|
+
]
|
113
|
+
|
114
|
+
|
115
|
+
YEOLDEPUNK_HEADWEAR = [
|
116
|
+
'Cowboy Hat (m)',
|
117
|
+
'Fedora (m)',
|
118
|
+
'Hoodie (m)',
|
119
|
+
'Beanie (m)',
|
120
|
+
'Top Hat (m)',
|
121
|
+
'Do-rag (m)',
|
122
|
+
'Police Cap (m)',
|
123
|
+
'Cap Forward (m)',
|
124
|
+
'Cap (m/f)',
|
125
|
+
'Knitted Cap (m/f)',
|
126
|
+
'Bandana (m/f)',
|
127
|
+
'Headband¹ (m/f)',
|
128
|
+
'Pilot Helmet (f)',
|
129
|
+
'Tassle Hat (f)',
|
130
|
+
'Tiara (f)',
|
131
|
+
]
|
132
|
+
|
133
|
+
YEOLDEPUNK_EYES = [
|
134
|
+
'Clown Eyes Green (m/f)',
|
135
|
+
'Clown Eyes Blue (m/f)',
|
136
|
+
'Green Eye Shadow (f)',
|
137
|
+
'Blue Eye Shadow (f)',
|
138
|
+
'Purple Eye Shadow (f)',
|
139
|
+
]
|
140
|
+
|
141
|
+
YEOLDEPUNK_MOUTH = [
|
142
|
+
'Smile (m)',
|
143
|
+
'Frown (m)',
|
144
|
+
'Buck Teeth (m)',
|
145
|
+
'Hot Lipstick (f)',
|
146
|
+
'Black Lipstick (f)',
|
147
|
+
'Purple Lipstick (f)',
|
148
|
+
]
|
149
|
+
|
150
|
+
|
151
|
+
YEOLDEPUNK_MOUTH_PROP = [
|
152
|
+
'Cigarette (m/f)',
|
153
|
+
'Vape (m/f)',
|
154
|
+
'Pipe (m/f)',
|
155
|
+
'Medical Mask (m/f)',
|
156
|
+
]
|
157
|
+
|
158
|
+
YEOLDEPUNK_NECK = [
|
159
|
+
'Silver Chain (m/f)',
|
160
|
+
'Gold Chain (m/f)',
|
161
|
+
'Choker (f)',
|
162
|
+
]
|
163
|
+
|
164
|
+
YEOLDEPUNK_BLEMISH = [
|
165
|
+
'Mole (m/f)',
|
166
|
+
'Spots (m/f)',
|
167
|
+
'Rosy Cheeks (m/f)',
|
168
|
+
]
|
169
|
+
|
170
|
+
YEOLDEPUNK_NOSE = [
|
171
|
+
'Clown Nose (m/f)',
|
172
|
+
]
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
DOGE_ARCHETYPE = [
|
178
|
+
'Classic',
|
179
|
+
'Dark',
|
180
|
+
'Zombie',
|
181
|
+
'Alien',
|
182
|
+
]
|
183
|
+
|
184
|
+
DOGE_HAIR = [
|
185
|
+
'Crazy Hair',
|
186
|
+
]
|
187
|
+
|
188
|
+
DOGE_HEADWEAR = [
|
189
|
+
'Beanie',
|
190
|
+
'Cap',
|
191
|
+
'Cap Forward',
|
192
|
+
'Cowboy Hat',
|
193
|
+
'Fedora',
|
194
|
+
'Knitted Cap',
|
195
|
+
'Top Hat',
|
196
|
+
'Bandana',
|
197
|
+
'Headband',
|
198
|
+
'Tiara',
|
199
|
+
]
|
200
|
+
|
201
|
+
DOGE_EYEWEAR = [
|
202
|
+
'3D Glasses',
|
203
|
+
'Big Shades',
|
204
|
+
'Classic Shades',
|
205
|
+
'Regular Shades',
|
206
|
+
'Small Shades',
|
207
|
+
'Nerd Glasses',
|
208
|
+
'Eye Patch',
|
209
|
+
]
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
MARC_ARCHETYPE = [
|
214
|
+
'Marc',
|
215
|
+
'Marc Mid',
|
216
|
+
'Marc Dark',
|
217
|
+
'Marc Albino',
|
218
|
+
'Marc Golden',
|
219
|
+
'Mad Lad',
|
220
|
+
'Zombie',
|
221
|
+
'Ape',
|
222
|
+
'Ape Golden',
|
223
|
+
'Ape Pink',
|
224
|
+
'Alien',
|
225
|
+
'Alien Green',
|
226
|
+
'Devil',
|
227
|
+
'Orc',
|
228
|
+
'Skeleton',
|
229
|
+
'Bot']
|
230
|
+
|
231
|
+
|
232
|
+
MARC_EYES = [
|
233
|
+
'Blue Eyes',
|
234
|
+
'Green Eyes',
|
235
|
+
]
|
236
|
+
|
237
|
+
MARC_FACE = [
|
238
|
+
'Blue Eye Shadow',
|
239
|
+
'Green Eye Shadow',
|
240
|
+
'Purple Eye Shadow',
|
241
|
+
'Clown Eyes Blue',
|
242
|
+
'Clown Eyes Green',
|
243
|
+
'Bagner',
|
244
|
+
'Marc Tyson',
|
245
|
+
'Tears',
|
246
|
+
]
|
247
|
+
|
248
|
+
MARC_BEARD = [
|
249
|
+
'Big Beard White',
|
250
|
+
'Big Beard',
|
251
|
+
'Chinstrap',
|
252
|
+
'Front Beard',
|
253
|
+
'Front Beard Dark',
|
254
|
+
'Full Mustache',
|
255
|
+
'Full Mustache Dark',
|
256
|
+
'Goat',
|
257
|
+
'Goat Dark',
|
258
|
+
'Handlebar',
|
259
|
+
'Luxurious Beard',
|
260
|
+
'Mustache',
|
261
|
+
'Mutton Chop',
|
262
|
+
'Normal Beard',
|
263
|
+
'Normal Beard Black',
|
264
|
+
'Shadow Beard',
|
265
|
+
'Soul Patch',
|
266
|
+
]
|
267
|
+
|
268
|
+
MARC_HAIR = [
|
269
|
+
'Blonde Bob',
|
270
|
+
'Chad',
|
271
|
+
'Clown Hair',
|
272
|
+
'Crazy White Hair',
|
273
|
+
'Crazy Hair',
|
274
|
+
'Frumpy Hair',
|
275
|
+
'Marc Three',
|
276
|
+
'Purple Hair',
|
277
|
+
'Stringy Hair',
|
278
|
+
'Vampire Hair',
|
279
|
+
'Wild Blonde Hair',
|
280
|
+
'Wild Hair',
|
281
|
+
]
|
282
|
+
|
283
|
+
MARC_HEADWEAR = [
|
284
|
+
'Bandana',
|
285
|
+
'Beanie',
|
286
|
+
'Bunny Ears',
|
287
|
+
'Cap',
|
288
|
+
'Skull Cap',
|
289
|
+
'Cap Forward',
|
290
|
+
'Police Cap',
|
291
|
+
'Cowboy Hat',
|
292
|
+
'Do Rag',
|
293
|
+
'Fast Food',
|
294
|
+
'Marcdonalds',
|
295
|
+
'Fedora',
|
296
|
+
'Headband',
|
297
|
+
'Roaring Headband',
|
298
|
+
'Hoodie',
|
299
|
+
'Purple Hoodie',
|
300
|
+
'Knitted Cap',
|
301
|
+
'Laurels',
|
302
|
+
'Shemagh',
|
303
|
+
'Tassle Hat',
|
304
|
+
'Tiarra',
|
305
|
+
'Top Hat',
|
306
|
+
'Uncle Sam',
|
307
|
+
'Viking',
|
308
|
+
'Welding Goggles',
|
309
|
+
]
|
310
|
+
|
311
|
+
|
312
|
+
MARC_EYEWEAR = [
|
313
|
+
'3D Glasses',
|
314
|
+
'Aviators',
|
315
|
+
'Big Shades',
|
316
|
+
'Classic Shades',
|
317
|
+
'Deal With It',
|
318
|
+
'Glasses',
|
319
|
+
'Gold Glasses',
|
320
|
+
'Horned-Rim Glasses',
|
321
|
+
'Monocle',
|
322
|
+
'Nerd Glasses',
|
323
|
+
'Pink Shades',
|
324
|
+
'Polarized',
|
325
|
+
'Polarized White',
|
326
|
+
'Regular Shades',
|
327
|
+
'Small Shades',
|
328
|
+
'VR Headset',
|
329
|
+
'Eye Mask',
|
330
|
+
'Eye Patch',
|
331
|
+
'Lasers']
|
332
|
+
|
333
|
+
MARC_MOUTH_PROP = [
|
334
|
+
'Cigar',
|
335
|
+
'Cigarette',
|
336
|
+
'Hookah',
|
337
|
+
'Pipe',
|
338
|
+
'Vape',
|
339
|
+
'Medical Mask',
|
340
|
+
'Bubble Gum' ]
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
1
345
|
class ProfilepicService < Sinatra::Base
|
2
346
|
|
347
|
+
get '/cache' do
|
348
|
+
|
349
|
+
html =<<HTML
|
350
|
+
<pre>
|
351
|
+
#{IMAGES.size} image(s) in cache:
|
352
|
+
|
353
|
+
|
354
|
+
</pre>
|
355
|
+
HTML
|
356
|
+
html
|
357
|
+
end
|
358
|
+
|
359
|
+
|
360
|
+
|
3
361
|
get '/' do
|
4
362
|
erb :index
|
5
363
|
end
|
6
364
|
|
365
|
+
get '/marcs' do
|
366
|
+
erb :marcs
|
367
|
+
end
|
7
368
|
|
8
|
-
get '/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
image generation (string) params:
|
16
|
-
type: >#{type}< - #{type.class.name}
|
17
|
-
attributes: >#{attributes}< - #{attributes.class.name}
|
18
|
-
zoom: >#{zoom}< - #{zoom.class.name}
|
19
|
-
background >#{background}< - #{background.class.name}
|
20
|
-
TXT
|
369
|
+
get '/doge' do
|
370
|
+
erb :doge
|
371
|
+
end
|
372
|
+
|
373
|
+
get '/yeoldepunks' do
|
374
|
+
erb :yeoldepunks
|
375
|
+
end
|
21
376
|
|
22
|
-
# convert attributes to array
|
23
|
-
## allow various separators
|
24
|
-
attributes = attributes.split( %r{[,;|+/]+} )
|
25
|
-
attributes = attributes.map { |attr| attr.strip }
|
26
|
-
attributes = attributes.select { |attr| !attr.empty?} ## remove empty strings (if any)
|
27
|
-
|
28
|
-
type = type.downcase.strip
|
29
|
-
zoom = zoom.strip.to_i( 10 )
|
30
|
-
background = background.downcase.strip
|
31
|
-
|
32
|
-
txt += <<TXT
|
33
|
-
resulting in:
|
34
|
-
type: >#{type}< - #{type.class.name}
|
35
|
-
#{attributes.size} attribute(s):
|
36
|
-
#{attributes.join(', ')}
|
37
|
-
zoom @ #{zoom}x - #{zoom.class.name}
|
38
|
-
background >#{background}< - #{background.class.name}
|
39
|
-
TXT
|
40
377
|
|
41
|
-
puts "generate request:"
|
42
|
-
puts txt
|
43
378
|
|
44
|
-
img = Original::Image.fabricate( type, *attributes )
|
45
|
-
img = img.background( background ) if background != 'none'
|
46
|
-
img = img.zoom( zoom ) if [2,3,4,5,6,7,8,9,10,20].include?( zoom )
|
47
379
|
|
48
|
-
|
49
|
-
# img.save( "./tmp/profilepic-#{Time.now.to_i}.png" )
|
380
|
+
get '/generate_marcs' do
|
50
381
|
|
51
|
-
|
382
|
+
r = ImageReq.build_marc( params )
|
383
|
+
|
384
|
+
img = r.image
|
385
|
+
|
386
|
+
blob = img.image.to_blob
|
387
|
+
IMAGES[ r.image_key ] = blob
|
388
|
+
redirect "/#{r.image_key}.png"
|
389
|
+
end
|
390
|
+
|
391
|
+
get '/generate_yeoldepunks' do
|
392
|
+
|
393
|
+
r = ImageReq.build_yeoldepunk( params )
|
394
|
+
|
395
|
+
img = r.image
|
396
|
+
|
397
|
+
blob = img.image.to_blob
|
398
|
+
IMAGES[ r.image_key ] = blob
|
399
|
+
redirect "/#{r.image_key}.png"
|
400
|
+
end
|
401
|
+
|
402
|
+
|
403
|
+
get '/generate_doge' do
|
404
|
+
|
405
|
+
r = ImageReq.build_doge( params )
|
406
|
+
|
407
|
+
img = r.image
|
408
|
+
|
409
|
+
blob = img.image.to_blob
|
410
|
+
IMAGES[ r.image_key ] = blob
|
411
|
+
redirect "/#{r.image_key}.png"
|
412
|
+
end
|
413
|
+
|
414
|
+
|
415
|
+
get '/generate' do
|
416
|
+
|
417
|
+
r = ImageReq.build( params )
|
418
|
+
|
419
|
+
img = r.image
|
52
420
|
|
53
421
|
blob = img.image.to_blob
|
54
|
-
blob
|
422
|
+
IMAGES[ r.image_key ] = blob
|
423
|
+
redirect "/#{r.image_key}.png"
|
424
|
+
end
|
425
|
+
|
426
|
+
|
427
|
+
get '/:key.png' do
|
428
|
+
puts " .png image request for key: >#{params[:key]}<"
|
429
|
+
|
430
|
+
blob = IMAGES[ params[:key] ]
|
431
|
+
|
432
|
+
if blob
|
433
|
+
headers( 'Content-Type' => "image/png" )
|
434
|
+
blob
|
435
|
+
else
|
436
|
+
"404 not found; sorry no generated .png image found for key >#{params[:key]}<"
|
437
|
+
end
|
55
438
|
end
|
56
439
|
end
|
57
440
|
|
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
|
@@ -33,6 +33,7 @@ own 100% forever.
|
|
33
33
|
<div>
|
34
34
|
<input type="radio" id="t4" name="t" value="marc">
|
35
35
|
<label for="t4">Marc (24×24)</label>
|
36
|
+
... or try the <b><a href="/marcs">Design Your Own Marc Wizard »</a></b>
|
36
37
|
</div>
|
37
38
|
|
38
39
|
<div>
|
@@ -40,10 +41,21 @@ own 100% forever.
|
|
40
41
|
<label for="t5">Saudi Sheik (24×24)</label>
|
41
42
|
</div>
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
<
|
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>
|
46
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
|
+
... or try the <b><a href="/yeoldepunks">Matt & John's® Ye Olde' Punk V1/V2 (Anno 2017) Wizard »</a></b>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
47
59
|
</fieldset>
|
48
60
|
|
49
61
|
|
@@ -74,53 +86,6 @@ own 100% forever.
|
|
74
86
|
</div>
|
75
87
|
|
76
88
|
|
77
|
-
|
78
|
-
|
79
|
-
<fieldset>
|
80
|
-
<legend>Select a zoom size:</legend>
|
81
|
-
|
82
|
-
<div>
|
83
|
-
<input type="radio" id="z1" name="z" value="1"
|
84
|
-
checked>
|
85
|
-
<label for="z1">1X</label>
|
86
|
-
</div>
|
87
|
-
|
88
|
-
<div>
|
89
|
-
<input type="radio" id="z2" name="z" value="2">
|
90
|
-
<label for="z2">2X</label>
|
91
|
-
</div>
|
92
|
-
|
93
|
-
<div>
|
94
|
-
<input type="radio" id="z4" name="z" value="4">
|
95
|
-
<label for="z4">4X</label>
|
96
|
-
</div>
|
97
|
-
|
98
|
-
<div>
|
99
|
-
<input type="radio" id="z8" name="z" value="8">
|
100
|
-
<label for="z8">8X</label>
|
101
|
-
</div>
|
102
|
-
</fieldset>
|
103
|
-
|
104
|
-
|
105
|
-
<fieldset>
|
106
|
-
<legend>Select a background:</legend>
|
107
|
-
|
108
|
-
<div>
|
109
|
-
<input type="radio" id="bg1" name="bg" value="none"
|
110
|
-
checked>
|
111
|
-
<label for="bg1">None (Transparent)</label>
|
112
|
-
</div>
|
113
|
-
|
114
|
-
<div>
|
115
|
-
<input type="radio" id="bg2" name="bg" value="ukraine">
|
116
|
-
<label for="bg2">We Stand With Ukraine</label>
|
117
|
-
</div>
|
118
|
-
|
119
|
-
<div>
|
120
|
-
<input type="radio" id="bg3" name="bg" value="rainbow">
|
121
|
-
<label for="bg3">Pride / Rainbow</label>
|
122
|
-
</div>
|
123
|
-
</fieldset>
|
124
|
-
|
89
|
+
<%= erb :'shared/_more_options' %>
|
125
90
|
|
126
91
|
</form>
|
@@ -0,0 +1,88 @@
|
|
1
|
+
<p style="font-size: 80%;">
|
2
|
+
<a href="/">« Profile Pic(ture) As A Service</a>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
|
6
|
+
<h1>Design Your Own Marc (24×24) Wizard</h1>
|
7
|
+
|
8
|
+
<p>Yes, you can!
|
9
|
+
Generate your own originals that you
|
10
|
+
own 100% forever.
|
11
|
+
</p>
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
<form action="/generate_marcs" method="get" id="form1">
|
16
|
+
|
17
|
+
|
18
|
+
<%= radio_options( MARC_ARCHETYPE,
|
19
|
+
name: 't',
|
20
|
+
legend: 'Select a marc base (archetype)' ) %>
|
21
|
+
|
22
|
+
Options:
|
23
|
+
|
24
|
+
|
25
|
+
<%= radio_options( ['None']+MARC_EYES,
|
26
|
+
name: 'eyes',
|
27
|
+
legend: 'Select eyes (extras)' ) %>
|
28
|
+
|
29
|
+
<%= radio_options( ['None']+MARC_FACE,
|
30
|
+
name: 'face',
|
31
|
+
legend: 'Select face (extras)' ) %>
|
32
|
+
|
33
|
+
<%= radio_options( ['None']+MARC_BEARD,
|
34
|
+
name: 'beard',
|
35
|
+
legend: 'Select beard' ) %>
|
36
|
+
|
37
|
+
<%= radio_options( ['None']+MARC_HAIR,
|
38
|
+
name: 'hair',
|
39
|
+
legend: 'Select hair' ) %>
|
40
|
+
|
41
|
+
<%= radio_options( ['None']+MARC_HEADWEAR,
|
42
|
+
name: 'headwear',
|
43
|
+
legend: 'Select headwear' ) %>
|
44
|
+
|
45
|
+
|
46
|
+
<%= radio_options( ['None']+MARC_EYEWEAR,
|
47
|
+
name: 'eyewear',
|
48
|
+
legend: 'Select eyewear' ) %>
|
49
|
+
|
50
|
+
<%= radio_options( ['None']+MARC_MOUTH_PROP,
|
51
|
+
name: 'mouth',
|
52
|
+
legend: 'Select mouth prop' ) %>
|
53
|
+
|
54
|
+
|
55
|
+
<div>
|
56
|
+
<button type="submit" form="form1" value="Submit"
|
57
|
+
style="font-size: 400%; color: white; background-color: blue;">Generate Profile Pic(ture) in .PNG Format</button>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
Or
|
63
|
+
|
64
|
+
<fieldset>
|
65
|
+
<legend>Type (more) attribute description / specification:</legend>
|
66
|
+
|
67
|
+
<div>
|
68
|
+
<input type="text" id="attributes" name="attributes"
|
69
|
+
minlength="0" maxlength="200" size="80"
|
70
|
+
style="font-size: 200%;"
|
71
|
+
placeholder="Attribute 1, Attribute 2, Attribute 3, ...">
|
72
|
+
|
73
|
+
<p>
|
74
|
+
Examples:
|
75
|
+
</p>
|
76
|
+
<ul>
|
77
|
+
<li>Normal Beard, Big Shades</li>
|
78
|
+
<li>Crazy Hair, 3D Glasses</li>
|
79
|
+
<li>Headband</li>
|
80
|
+
</ul>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
</fieldset>
|
84
|
+
|
85
|
+
|
86
|
+
<%= erb :'shared/_more_options' %>
|
87
|
+
|
88
|
+
</form>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
<p>More options:</p>
|
3
|
+
|
4
|
+
<fieldset>
|
5
|
+
<legend>Select a zoom size:</legend>
|
6
|
+
|
7
|
+
<div>
|
8
|
+
<input type="radio" id="z1" name="z" value="1"
|
9
|
+
checked>
|
10
|
+
<label for="z1">1X</label>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div>
|
14
|
+
<input type="radio" id="z2" name="z" value="2">
|
15
|
+
<label for="z2">2X</label>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div>
|
19
|
+
<input type="radio" id="z4" name="z" value="4">
|
20
|
+
<label for="z4">4X</label>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div>
|
24
|
+
<input type="radio" id="z8" name="z" value="8">
|
25
|
+
<label for="z8">8X</label>
|
26
|
+
</div>
|
27
|
+
</fieldset>
|
28
|
+
|
29
|
+
|
30
|
+
<fieldset>
|
31
|
+
<legend>Select a background:</legend>
|
32
|
+
|
33
|
+
<div>
|
34
|
+
<input type="radio" id="bg1" name="bg" value="none"
|
35
|
+
checked>
|
36
|
+
<label for="bg1">None (Transparent)</label>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div>
|
40
|
+
<input type="radio" id="bg2" name="bg" value="ukraine">
|
41
|
+
<label for="bg2">We Stand With Ukraine</label>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div>
|
45
|
+
<input type="radio" id="bg3" name="bg" value="rainbow">
|
46
|
+
<label for="bg3">Pride / Rainbow</label>
|
47
|
+
</div>
|
48
|
+
</fieldset>
|
49
|
+
|
@@ -0,0 +1,91 @@
|
|
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 Matt & John's® Ye Olde' Punk (Anno 2017) (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_yeoldepunks" method="get" id="form1">
|
17
|
+
|
18
|
+
|
19
|
+
<%= radio_options( YEOLDEPUNK_ARCHETYPE,
|
20
|
+
name: 't',
|
21
|
+
legend: "Select a ye olde' punk base (archetype)" ) %>
|
22
|
+
|
23
|
+
Options:
|
24
|
+
|
25
|
+
<%= radio_options( ['None']+YEOLDEPUNK_HAIR,
|
26
|
+
name: 'hair',
|
27
|
+
legend: 'Select hair' ) %>
|
28
|
+
|
29
|
+
¹: Note: Pink With Hat is a hair+headwear combo.
|
30
|
+
|
31
|
+
<%= radio_options( ['None']+YEOLDEPUNK_BEARD,
|
32
|
+
name: 'beard',
|
33
|
+
legend: 'Select beard' ) %>
|
34
|
+
|
35
|
+
<%= radio_options( ['None']+YEOLDEPUNK_EYES,
|
36
|
+
name: 'eyes',
|
37
|
+
legend: 'Select eyes (make-up)' ) %>
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
<%= radio_options( ['None']+YEOLDEPUNK_EYEWEAR,
|
42
|
+
name: 'eyewear',
|
43
|
+
legend: 'Select eyewear' ) %>
|
44
|
+
|
45
|
+
|
46
|
+
<%= radio_options( ['None']+YEOLDEPUNK_NOSE,
|
47
|
+
name: 'nose',
|
48
|
+
legend: 'Select nose accessory' ) %>
|
49
|
+
|
50
|
+
<%= radio_options( ['None']+YEOLDEPUNK_BLEMISH,
|
51
|
+
name: 'blemish',
|
52
|
+
legend: 'Select blemish' ) %>
|
53
|
+
|
54
|
+
|
55
|
+
<%= radio_options( ['None']+YEOLDEPUNK_MOUTH,
|
56
|
+
name: 'mouth',
|
57
|
+
legend: 'Select mouth expression / lipstick make-up' ) %>
|
58
|
+
|
59
|
+
|
60
|
+
<%= radio_options( ['None']+YEOLDEPUNK_MOUTH_PROP,
|
61
|
+
name: 'mouthprop',
|
62
|
+
legend: 'Select mouth prop' ) %>
|
63
|
+
|
64
|
+
|
65
|
+
<%= radio_options( ['None']+YEOLDEPUNK_EARRING,
|
66
|
+
name: 'earring',
|
67
|
+
legend: 'Select earring' ) %>
|
68
|
+
|
69
|
+
|
70
|
+
<%= radio_options( ['None']+YEOLDEPUNK_HEADWEAR,
|
71
|
+
name: 'headwear',
|
72
|
+
legend: 'Select headwear' ) %>
|
73
|
+
|
74
|
+
¹: Note: Headband (f) is a (black) hair+headwear combo.
|
75
|
+
|
76
|
+
|
77
|
+
<%= radio_options( ['None']+YEOLDEPUNK_NECK,
|
78
|
+
name: 'neck',
|
79
|
+
legend: 'Select neck accessory' ) %>
|
80
|
+
|
81
|
+
|
82
|
+
<div>
|
83
|
+
<button type="submit" form="form1" value="Submit"
|
84
|
+
style="font-size: 400%; color: white; background-color: blue;">Generate Profile Pic(ture) in .PNG Format</button>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<%= erb :'shared/_more_options' %>
|
90
|
+
|
91
|
+
</form>
|
data/lib/profilepic.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: originals
|
@@ -102,12 +102,17 @@ files:
|
|
102
102
|
- Rakefile
|
103
103
|
- bin/profilepic
|
104
104
|
- lib/profilepic.rb
|
105
|
+
- lib/profilepic/builder.rb
|
105
106
|
- lib/profilepic/public/style.css
|
106
107
|
- lib/profilepic/service.rb
|
107
108
|
- lib/profilepic/version.rb
|
109
|
+
- lib/profilepic/views/doge.erb
|
108
110
|
- lib/profilepic/views/index.erb
|
109
111
|
- lib/profilepic/views/layout.erb
|
112
|
+
- lib/profilepic/views/marcs.erb
|
113
|
+
- lib/profilepic/views/shared/_more_options.erb
|
110
114
|
- lib/profilepic/views/shared/_version.erb
|
115
|
+
- lib/profilepic/views/yeoldepunks.erb
|
111
116
|
homepage: https://github.com/profilepic/profilepic
|
112
117
|
licenses:
|
113
118
|
- Public Domain
|