profilepic 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Manifest.txt +6 -0
- data/Rakefile +3 -1
- data/bin/profilepic +18 -0
- data/lib/profilepic/public/style.css +28 -0
- data/lib/profilepic/service.rb +58 -0
- data/lib/profilepic/version.rb +2 -2
- data/lib/profilepic/views/index.erb +126 -0
- data/lib/profilepic/views/layout.erb +17 -0
- data/lib/profilepic/views/shared/_version.erb +5 -0
- data/lib/profilepic.rb +31 -2
- metadata +39 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f6333d662946773d2af33fa3d776bafe894e7bf91086d2258ab10b2395d91d6
|
|
4
|
+
data.tar.gz: 73bcbdc5a25884aafc8f2cdbc85b4658b09e0c371cd2c8ff1d4b6664ea0da3ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0236e6a9e43d77384c1beb48dcd0e2e107c110026e56ef8fa45862c4d035451afd07a6194c4d9efebb69a5995be6026998d8d51f521183c893cd95777a7bf806
|
|
7
|
+
data.tar.gz: 4324b06b0fffaab639a3e5a580b21ecd40ee9067c99b097536a912a6e7350baf3b5a6b2478c5a0a50b9a998a5200024ec7f7f8af82d459cc73618d0497a04744
|
data/Manifest.txt
CHANGED
|
@@ -2,5 +2,11 @@ CHANGELOG.md
|
|
|
2
2
|
Manifest.txt
|
|
3
3
|
README.md
|
|
4
4
|
Rakefile
|
|
5
|
+
bin/profilepic
|
|
5
6
|
lib/profilepic.rb
|
|
7
|
+
lib/profilepic/public/style.css
|
|
8
|
+
lib/profilepic/service.rb
|
|
6
9
|
lib/profilepic/version.rb
|
|
10
|
+
lib/profilepic/views/index.erb
|
|
11
|
+
lib/profilepic/views/layout.erb
|
|
12
|
+
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(
|
|
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,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,58 @@
|
|
|
1
|
+
class ProfilepicService < Sinatra::Base
|
|
2
|
+
|
|
3
|
+
get '/' do
|
|
4
|
+
erb :index
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
get '/generate' do
|
|
9
|
+
type = params[:t] || "punk"
|
|
10
|
+
attributes = params[:attributes] || ""
|
|
11
|
+
zoom = params[:z] || "1"
|
|
12
|
+
background = params[:bg] || "none"
|
|
13
|
+
|
|
14
|
+
txt= <<TXT
|
|
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
|
|
21
|
+
|
|
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
|
+
|
|
41
|
+
puts "generate request:"
|
|
42
|
+
puts txt
|
|
43
|
+
|
|
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
|
+
|
|
48
|
+
# check - add a debug/save option - why? why not?
|
|
49
|
+
# img.save( "./tmp/profilepic-#{Time.now.to_i}.png" )
|
|
50
|
+
|
|
51
|
+
headers( 'Content-Type' => "image/png" )
|
|
52
|
+
|
|
53
|
+
blob = img.image.to_blob
|
|
54
|
+
blob
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
|
data/lib/profilepic/version.rb
CHANGED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<h1>Profile Pic(ture) As 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
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div>
|
|
39
|
+
<input type="radio" id="t5" name="t" value="saudi">
|
|
40
|
+
<label for="t5">Saudi Sheik (24×24)</label>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div>
|
|
44
|
+
<input type="radio" id="t6" name="t" value="yeoldepunk">
|
|
45
|
+
<label for="t6">Matt & John's® Ye Olde' Punk V1/V2 (Anno 2017) (24×24)</label>
|
|
46
|
+
</div>
|
|
47
|
+
</fieldset>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<fieldset>
|
|
51
|
+
<legend>Type attribute description / specification:</legend>
|
|
52
|
+
|
|
53
|
+
<div>
|
|
54
|
+
<input type="text" id="attributes" name="attributes"
|
|
55
|
+
minlength="0" maxlength="200" size="80"
|
|
56
|
+
style="font-size: 200%;"
|
|
57
|
+
placeholder="Attribute 1, Attribute 2, Attribute 3, ...">
|
|
58
|
+
|
|
59
|
+
<p>
|
|
60
|
+
Examples:
|
|
61
|
+
</p>
|
|
62
|
+
<ul>
|
|
63
|
+
<li>Female 2, Wild Blonde, Earring, Mole, Big Shades</li>
|
|
64
|
+
<li>Zombie, Crazy Hair, 3D Glasses</li>
|
|
65
|
+
<li>Alien, Headband</li>
|
|
66
|
+
</ul>
|
|
67
|
+
|
|
68
|
+
</div>
|
|
69
|
+
</fieldset>
|
|
70
|
+
|
|
71
|
+
<div>
|
|
72
|
+
<button type="submit" form="form1" value="Submit"
|
|
73
|
+
style="font-size: 400%; color: white; background-color: blue;">Generate Profile Pic(ture) in .PNG Format</button>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
<p>More options:</p>
|
|
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
|
+
|
|
125
|
+
|
|
126
|
+
</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,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,46 @@
|
|
|
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/service'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
module Profilepic
|
|
16
|
+
def self.main
|
|
17
|
+
puts 'hello from main'
|
|
7
18
|
|
|
19
|
+
#####
|
|
20
|
+
# fix/todo:
|
|
21
|
+
## use differnt port ??
|
|
22
|
+
##
|
|
23
|
+
## use --local for host e.g. 127.0.0.1 insteaod of 0.0.0.0 ???
|
|
8
24
|
|
|
25
|
+
# puts 'before Puma.run app'
|
|
26
|
+
# require 'rack/handler/puma'
|
|
27
|
+
# Rack::Handler::Puma.run ProfilepicService, :Port => 3000, :Host => '0.0.0.0'
|
|
28
|
+
# puts 'after Puma.run app'
|
|
29
|
+
|
|
30
|
+
# use webrick for now - why? why not?
|
|
31
|
+
puts 'before WEBrick.run service'
|
|
32
|
+
Rack::Handler::WEBrick.run ProfilepicService, :Port => 3000, :Host => '127.0.0.1'
|
|
33
|
+
puts 'after WEBrick.run service'
|
|
34
|
+
|
|
35
|
+
puts 'bye'
|
|
36
|
+
end
|
|
37
|
+
end
|
|
9
38
|
|
|
10
39
|
|
|
11
40
|
####
|
|
12
41
|
# convenience aliases / shortcuts / alternate spellings
|
|
13
|
-
ProfilePic
|
|
14
|
-
|
|
42
|
+
ProfilePic = Profilepic
|
|
43
|
+
ProfilePicService = ProfilepicService
|
|
15
44
|
|
|
16
45
|
|
|
17
46
|
|
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.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gerald Bauer
|
|
@@ -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(
|
|
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,14 @@ files:
|
|
|
71
100
|
- Manifest.txt
|
|
72
101
|
- README.md
|
|
73
102
|
- Rakefile
|
|
103
|
+
- bin/profilepic
|
|
74
104
|
- lib/profilepic.rb
|
|
105
|
+
- lib/profilepic/public/style.css
|
|
106
|
+
- lib/profilepic/service.rb
|
|
75
107
|
- lib/profilepic/version.rb
|
|
108
|
+
- lib/profilepic/views/index.erb
|
|
109
|
+
- lib/profilepic/views/layout.erb
|
|
110
|
+
- lib/profilepic/views/shared/_version.erb
|
|
76
111
|
homepage: https://github.com/profilepic/profilepic
|
|
77
112
|
licenses:
|
|
78
113
|
- Public Domain
|
|
@@ -97,5 +132,5 @@ requirements: []
|
|
|
97
132
|
rubygems_version: 3.3.7
|
|
98
133
|
signing_key:
|
|
99
134
|
specification_version: 4
|
|
100
|
-
summary: profilepic - profile pic(
|
|
135
|
+
summary: profilepic - profile pic(ture) as a service
|
|
101
136
|
test_files: []
|