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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ba2adc7eb706d797e6295d1aa4a2a66a84cb48e70e82355cdd60e519436fe78
4
- data.tar.gz: 0efd5f64c0506376f1a61af437dc2085a771a057719d9a59e1894d6c74a50604
3
+ metadata.gz: b4cb3b184f5c14e2e509c873de59631a56687492ea6dc3a20c33c9dd261ca9c1
4
+ data.tar.gz: 85204077ae0502dd27e3ccaa15fa94f2afe539c2bad6e0f23f8602b053be6732
5
5
  SHA512:
6
- metadata.gz: 0bf5c048b1ff9cf265b67c1b4d1b390f15dc46bc4d43b300ae52a7487b97836c849b1bacf0dbc107ba78284d8479e303216ff9f32e316ee1a2e0c6c37bfe7b79
7
- data.tar.gz: 6d6692873afe1b608c354bfc23124be010ec209d90beacfa6bade0bb119ae11400fe4af4a885bdccc516b7173b9891322b5cea9631a7f82c280e6952bc6c9e86
6
+ metadata.gz: 85dacbe04ffc88a2e0b72197d48c4f33c4019926ae76eddaa523ca898b86442bdb0d7ba3d96ae18f43a57792b1a4132614fb0518fa91d051c5074b124b370b4d
7
+ data.tar.gz: 0a0f9eefccd51a8d367482a26dd1fc335c1041d1a073aafb14c71e0262fd570f68188f734d00755c2579806a6c30b18d3fe8b871227a9d23200facab299f124b
data/Manifest.txt CHANGED
@@ -8,6 +8,7 @@ lib/profilepic/builder.rb
8
8
  lib/profilepic/public/style.css
9
9
  lib/profilepic/service.rb
10
10
  lib/profilepic/version.rb
11
+ lib/profilepic/views/doge.erb
11
12
  lib/profilepic/views/index.erb
12
13
  lib/profilepic/views/layout.erb
13
14
  lib/profilepic/views/marcs.erb
@@ -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
- def self._norm_key( str )
61
- str.downcase.strip
62
- end
63
+ name = 'doge'
64
+ archetype = _norm_key( params[:t] || 'classic' )
65
+ more_attributes = _parse_attributes( params[:attributes] || '' )
63
66
 
64
- def self._parse_attributes( str )
65
- # convert attributes to array
66
- ## allow various separators
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
- def self._parse_zoom( str )
74
- str.strip.to_i( 10 )
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
 
@@ -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 )
@@ -3,7 +3,7 @@
3
3
  module Profilepic
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- PATCH = 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>
@@ -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
- <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
+ </div>
55
+
56
+
48
57
  </fieldset>
49
58
 
50
59
 
@@ -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
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.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