profilepic 0.0.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16107e3018976b2e83a60246d8997efb87bd36870a570d384df7b12967d1fc89
4
- data.tar.gz: b0383b166aa51bed2bc09530d26b474e9927d284b466279cfc6d9d0307dfb031
3
+ metadata.gz: b4cb3b184f5c14e2e509c873de59631a56687492ea6dc3a20c33c9dd261ca9c1
4
+ data.tar.gz: 85204077ae0502dd27e3ccaa15fa94f2afe539c2bad6e0f23f8602b053be6732
5
5
  SHA512:
6
- metadata.gz: c018701f85b09f2f8033cc1fb21ee3ddb81ec83ccd7c7c863d0b2a37ac000893c293a947341380f29ee32d5732672c38ac379eaa46fa2aa33add76596ea4775b
7
- data.tar.gz: 37311c4b6de44151128048d398f932dc57bc4b13a5fdc288753b027d8bc32b9a666be69fbfcc9e63dffe36854cd659d2d03b787bafd741de03ba748ed6454832
6
+ metadata.gz: 85dacbe04ffc88a2e0b72197d48c4f33c4019926ae76eddaa523ca898b86442bdb0d7ba3d96ae18f43a57792b1a4132614fb0518fa91d051c5074b124b370b4d
7
+ data.tar.gz: 0a0f9eefccd51a8d367482a26dd1fc335c1041d1a073aafb14c71e0262fd570f68188f734d00755c2579806a6c30b18d3fe8b871227a9d23200facab299f124b
data/Manifest.txt CHANGED
@@ -2,5 +2,15 @@ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ bin/profilepic
5
6
  lib/profilepic.rb
7
+ lib/profilepic/builder.rb
8
+ lib/profilepic/public/style.css
9
+ lib/profilepic/service.rb
6
10
  lib/profilepic/version.rb
11
+ lib/profilepic/views/doge.erb
12
+ lib/profilepic/views/index.erb
13
+ lib/profilepic/views/layout.erb
14
+ lib/profilepic/views/marcs.erb
15
+ lib/profilepic/views/shared/_more_options.erb
16
+ lib/profilepic/views/shared/_version.erb
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ Hoe.spec 'profilepic' do
6
6
 
7
7
  self.version = Profilepic::VERSION
8
8
 
9
- self.summary = "profilepic - profile pic(tures) as a service"
9
+ self.summary = "profilepic - profile pic(ture) as a service"
10
10
  self.description = summary
11
11
 
12
12
  self.urls = { home: 'https://github.com/profilepic/profilepic' }
@@ -20,6 +20,8 @@ Hoe.spec 'profilepic' do
20
20
 
21
21
  self.extra_deps = [
22
22
  ['originals'],
23
+ ['sinatra'],
24
+ ['webrick'],
23
25
  ]
24
26
 
25
27
  self.licenses = ['Public Domain']
data/bin/profilepic ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ###################
4
+ # == DEV TIPS:
5
+ #
6
+ # For local testing run like:
7
+ #
8
+ # ruby -Ilib bin/profilepic
9
+ #
10
+ # Set the executable bit in Linux. Example:
11
+ #
12
+ # % chmod a+x bin/profilepic
13
+ #
14
+
15
+ require 'profilepic'
16
+
17
+
18
+ Profilepic.main
@@ -0,0 +1,135 @@
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
+
87
+ attr_reader :name,
88
+ :attributes,
89
+ :zoom,
90
+ :background
91
+ def initialize( name:, attributes:, zoom:, background: )
92
+ @name = name
93
+ @attributes = attributes
94
+ @zoom = zoom
95
+ @background = background
96
+ end
97
+
98
+ def image
99
+ img = Original::Image.fabricate( @name, *@attributes )
100
+ img = img.background( @background ) if @background != 'none'
101
+ img = img.zoom( @zoom ) if [2,3,4,5,6,7,8,9,10,20].include?( @zoom )
102
+ img
103
+ end
104
+
105
+ def image_key
106
+ @key ||= begin
107
+ key = "#{@name}#{Time.now.to_i}"
108
+ key << "@#{@zoom}x" if [2,3,4,5,6,7,8,9,10,20].include?( @zoom )
109
+ key
110
+ end
111
+ @key
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
+
134
+ end
135
+
@@ -0,0 +1,28 @@
1
+ body {
2
+ font-family: sans-serif;
3
+ color: #333333;
4
+ }
5
+
6
+ a, a:visited {
7
+ text-decoration: none;
8
+ /* color: maroon; */
9
+ }
10
+
11
+ a:hover {
12
+ text-decoration: underline;
13
+ /* color: maroon; */
14
+ }
15
+
16
+
17
+
18
+
19
+ /** version block **********/
20
+
21
+ .version {
22
+ text-align: center;
23
+ margin-top: 10px;
24
+ color: grey; }
25
+ .version a, .version span {
26
+ font-size: 12px;
27
+ color: grey; }
28
+
@@ -0,0 +1,281 @@
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
+ label = option
19
+
20
+ buf += <<TXT
21
+ <div>
22
+ <input type="radio" id="#{name}#{i}" name="#{name}" value="#{value}"
23
+ #{ i==0 ? 'checked' : '' }
24
+ <label for="#{name}#{i}">#{label}</label>
25
+ </div>
26
+ TXT
27
+ end
28
+
29
+ buf += "</fieldset>\n"
30
+ buf
31
+ end
32
+
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
+
69
+
70
+ MARC_ARCHETYPE = [
71
+ 'Marc',
72
+ 'Marc Mid',
73
+ 'Marc Dark',
74
+ 'Marc Albino',
75
+ 'Marc Golden',
76
+ 'Mad Lad',
77
+ 'Zombie',
78
+ 'Ape',
79
+ 'Ape Golden',
80
+ 'Ape Pink',
81
+ 'Alien',
82
+ 'Alien Green',
83
+ 'Devil',
84
+ 'Orc',
85
+ 'Skeleton',
86
+ 'Bot']
87
+
88
+
89
+ MARC_EYES = [
90
+ 'Blue Eyes',
91
+ 'Green Eyes',
92
+ ]
93
+
94
+ MARC_FACE = [
95
+ 'Blue Eye Shadow',
96
+ 'Green Eye Shadow',
97
+ 'Purple Eye Shadow',
98
+ 'Clown Eyes Blue',
99
+ 'Clown Eyes Green',
100
+ 'Bagner',
101
+ 'Marc Tyson',
102
+ 'Tears',
103
+ ]
104
+
105
+ MARC_BEARD = [
106
+ 'Big Beard White',
107
+ 'Big Beard',
108
+ 'Chinstrap',
109
+ 'Front Beard',
110
+ 'Front Beard Dark',
111
+ 'Full Mustache',
112
+ 'Full Mustache Dark',
113
+ 'Goat',
114
+ 'Goat Dark',
115
+ 'Handlebar',
116
+ 'Luxurious Beard',
117
+ 'Mustache',
118
+ 'Mutton Chop',
119
+ 'Normal Beard',
120
+ 'Normal Beard Black',
121
+ 'Shadow Beard',
122
+ 'Soul Patch',
123
+ ]
124
+
125
+ MARC_HAIR = [
126
+ 'Blonde Bob',
127
+ 'Chad',
128
+ 'Clown Hair',
129
+ 'Crazy White Hair',
130
+ 'Crazy Hair',
131
+ 'Frumpy Hair',
132
+ 'Marc Three',
133
+ 'Purple Hair',
134
+ 'Stringy Hair',
135
+ 'Vampire Hair',
136
+ 'Wild Blonde Hair',
137
+ 'Wild Hair',
138
+ ]
139
+
140
+ MARC_HEADWEAR = [
141
+ 'Bandana',
142
+ 'Beanie',
143
+ 'Bunny Ears',
144
+ 'Cap',
145
+ 'Skull Cap',
146
+ 'Cap Forward',
147
+ 'Police Cap',
148
+ 'Cowboy Hat',
149
+ 'Do Rag',
150
+ 'Fast Food',
151
+ 'Marcdonalds',
152
+ 'Fedora',
153
+ 'Headband',
154
+ 'Roaring Headband',
155
+ 'Hoodie',
156
+ 'Purple Hoodie',
157
+ 'Knitted Cap',
158
+ 'Laurels',
159
+ 'Shemagh',
160
+ 'Tassle Hat',
161
+ 'Tiarra',
162
+ 'Top Hat',
163
+ 'Uncle Sam',
164
+ 'Viking',
165
+ 'Welding Goggles',
166
+ ]
167
+
168
+
169
+ MARC_EYEWEAR = [
170
+ '3D Glasses',
171
+ 'Aviators',
172
+ 'Big Shades',
173
+ 'Classic Shades',
174
+ 'Deal With It',
175
+ 'Glasses',
176
+ 'Gold Glasses',
177
+ 'Horned-Rim Glasses',
178
+ 'Monocle',
179
+ 'Nerd Glasses',
180
+ 'Pink Shades',
181
+ 'Polarized',
182
+ 'Polarized White',
183
+ 'Regular Shades',
184
+ 'Small Shades',
185
+ 'VR Headset',
186
+ 'Eye Mask',
187
+ 'Eye Patch',
188
+ 'Lasers']
189
+
190
+ MARC_MOUTH_PROP = [
191
+ 'Cigar',
192
+ 'Cigarette',
193
+ 'Hookah',
194
+ 'Pipe',
195
+ 'Vape',
196
+ 'Medical Mask',
197
+ 'Bubble Gum' ]
198
+
199
+
200
+
201
+
202
+ class ProfilepicService < Sinatra::Base
203
+
204
+ get '/cache' do
205
+
206
+ html =<<HTML
207
+ <pre>
208
+ #{IMAGES.size} image(s) in cache:
209
+
210
+
211
+ </pre>
212
+ HTML
213
+ html
214
+ end
215
+
216
+
217
+
218
+ get '/' do
219
+ erb :index
220
+ end
221
+
222
+ get '/marcs' do
223
+ erb :marcs
224
+ end
225
+
226
+ get '/doge' do
227
+ erb :doge
228
+ end
229
+
230
+
231
+ get '/generate_marcs' do
232
+
233
+ r = ImageReq.build_marc( params )
234
+
235
+ img = r.image
236
+
237
+ blob = img.image.to_blob
238
+ IMAGES[ r.image_key ] = blob
239
+ redirect "/#{r.image_key}.png"
240
+ end
241
+
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
+
255
+ get '/generate' do
256
+
257
+ r = ImageReq.build( params )
258
+
259
+ img = r.image
260
+
261
+ blob = img.image.to_blob
262
+ IMAGES[ r.image_key ] = blob
263
+ redirect "/#{r.image_key}.png"
264
+ end
265
+
266
+
267
+ get '/:key.png' do
268
+ puts " .png image request for key: >#{params[:key]}<"
269
+
270
+ blob = IMAGES[ params[:key] ]
271
+
272
+ if blob
273
+ headers( 'Content-Type' => "image/png" )
274
+ blob
275
+ else
276
+ "404 not found; sorry no generated .png image found for key >#{params[:key]}<"
277
+ end
278
+ end
279
+ end
280
+
281
+
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Profilepic
4
4
  MAJOR = 0
5
- MINOR = 0
6
- PATCH = 1
5
+ MINOR = 1
6
+ PATCH = 2
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
@@ -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>
@@ -0,0 +1,89 @@
1
+
2
+
3
+ <h1>Profile Pic(ture) As A Service</h1>
4
+
5
+ <p>Yes, you can!
6
+ Generate your own originals that you
7
+ own 100% forever.
8
+ </p>
9
+
10
+
11
+
12
+ <form action="/generate" method="get" id="form1">
13
+
14
+ <fieldset>
15
+ <legend>Select an image generator:</legend>
16
+
17
+ <div>
18
+ <input type="radio" id="t1" name="t" value="punk"
19
+ checked>
20
+ <label for="t1">Punk (24×24)</label>
21
+ </div>
22
+
23
+ <div>
24
+ <input type="radio" id="t2" name="t" value="phunk">
25
+ <label for="t2">Phunk (24×24)</label>
26
+ </div>
27
+
28
+ <div>
29
+ <input type="radio" id="t3" name="t" value="marilyn">
30
+ <label for="t3">Marilyn (24×24)</label>
31
+ </div>
32
+
33
+ <div>
34
+ <input type="radio" id="t4" name="t" value="marc">
35
+ <label for="t4">Marc (24×24)</label>
36
+ ... or try the <b><a href="/marcs">Design Your Own Marc Wizard »</a></b>
37
+ </div>
38
+
39
+ <div>
40
+ <input type="radio" id="t5" name="t" value="saudi">
41
+ <label for="t5">Saudi Sheik (24×24)</label>
42
+ </div>
43
+
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>
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
+ </div>
55
+
56
+
57
+ </fieldset>
58
+
59
+
60
+ <fieldset>
61
+ <legend>Type 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>Female 2, Wild Blonde, Earring, Mole, Big Shades</li>
74
+ <li>Zombie, Crazy Hair, 3D Glasses</li>
75
+ <li>Alien, Headband</li>
76
+ </ul>
77
+
78
+ </div>
79
+ </fieldset>
80
+
81
+ <div>
82
+ <button type="submit" form="form1" value="Submit"
83
+ style="font-size: 400%; color: white; background-color: blue;">Generate Profile Pic(ture) in .PNG Format</button>
84
+ </div>
85
+
86
+
87
+ <%= erb :'shared/_more_options' %>
88
+
89
+ </form>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+
6
+ <title>Profile Pic(ture) As A Service</title>
7
+
8
+ <link href="<%= url('/style.css') %>" rel='stylesheet'>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ <%= erb :'shared/_version' %>
15
+
16
+ </body>
17
+ </html>
@@ -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,5 @@
1
+ <div class='version'>
2
+ <a href="https://github.com/profilepic/profilepic">profilepic/<%= Profilepic::VERSION %></a> -
3
+ <span>ruby/<%= "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM})" %> on</span>
4
+ <span>sinatra/<%= Sinatra::VERSION %> (<%= ENV['RACK_ENV'] %>)</span>
5
+ </div>
data/lib/profilepic.rb CHANGED
@@ -1,17 +1,47 @@
1
1
  ## 3rd party libs
2
2
  require 'originals'
3
3
 
4
+ ## pull-in web service support
5
+ require 'sinatra/base' ## note: using the "modular" style
6
+ require 'webrick'
7
+
4
8
 
5
9
  ## our own code
6
10
  require 'profilepic/version' # note: let version always go first
11
+ require 'profilepic/builder'
12
+ require 'profilepic/service'
13
+
14
+
15
+
16
+ module Profilepic
17
+ def self.main
18
+ puts 'hello from main'
7
19
 
20
+ #####
21
+ # fix/todo:
22
+ ## use differnt port ??
23
+ ##
24
+ ## use --local for host e.g. 127.0.0.1 insteaod of 0.0.0.0 ???
8
25
 
26
+ # puts 'before Puma.run app'
27
+ # require 'rack/handler/puma'
28
+ # Rack::Handler::Puma.run ProfilepicService, :Port => 3000, :Host => '0.0.0.0'
29
+ # puts 'after Puma.run app'
30
+
31
+ # use webrick for now - why? why not?
32
+ puts 'before WEBrick.run service'
33
+ Rack::Handler::WEBrick.run ProfilepicService, :Port => 3000, :Host => '127.0.0.1'
34
+ puts 'after WEBrick.run service'
35
+
36
+ puts 'bye'
37
+ end
38
+ end
9
39
 
10
40
 
11
41
  ####
12
42
  # convenience aliases / shortcuts / alternate spellings
13
- ProfilePic = Profilepic
14
-
43
+ ProfilePic = Profilepic
44
+ ProfilePicService = ProfilepicService
15
45
 
16
46
 
17
47
 
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.0.1
4
+ version: 0.1.2
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-04 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: originals
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: webrick
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rdoc
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -58,9 +86,10 @@ dependencies:
58
86
  - - "~>"
59
87
  - !ruby/object:Gem::Version
60
88
  version: '3.23'
61
- description: profilepic - profile pic(tures) as a service
89
+ description: profilepic - profile pic(ture) as a service
62
90
  email: wwwmake@googlegroups.com
63
- executables: []
91
+ executables:
92
+ - profilepic
64
93
  extensions: []
65
94
  extra_rdoc_files:
66
95
  - CHANGELOG.md
@@ -71,8 +100,18 @@ files:
71
100
  - Manifest.txt
72
101
  - README.md
73
102
  - Rakefile
103
+ - bin/profilepic
74
104
  - lib/profilepic.rb
105
+ - lib/profilepic/builder.rb
106
+ - lib/profilepic/public/style.css
107
+ - lib/profilepic/service.rb
75
108
  - lib/profilepic/version.rb
109
+ - lib/profilepic/views/doge.erb
110
+ - lib/profilepic/views/index.erb
111
+ - lib/profilepic/views/layout.erb
112
+ - lib/profilepic/views/marcs.erb
113
+ - lib/profilepic/views/shared/_more_options.erb
114
+ - lib/profilepic/views/shared/_version.erb
76
115
  homepage: https://github.com/profilepic/profilepic
77
116
  licenses:
78
117
  - Public Domain
@@ -97,5 +136,5 @@ requirements: []
97
136
  rubygems_version: 3.3.7
98
137
  signing_key:
99
138
  specification_version: 4
100
- summary: profilepic - profile pic(tures) as a service
139
+ summary: profilepic - profile pic(ture) as a service
101
140
  test_files: []