Commit 0df73e95fb4fbf671264a3792c89c00b65962fc2
1 parent
e40515be
Exists in
master
more options configurable, version bumped
Showing
4 changed files
with
12 additions
and
10 deletions
Show diff stats
README.md
... | ... | @@ -48,9 +48,10 @@ $ gem install letter_avatar |
48 | 48 | |
49 | 49 | ```ruby |
50 | 50 | LetterAvatar.setup do |config| |
51 | - config.cache_base_path = 'public/system/lets' # default is 'public/system' | |
52 | - config.colors_palette = :iwanthue # default is :google | |
53 | - config.weight = 500 # default is 300 | |
51 | + config.cache_base_path = 'public/system/lets' # default is 'public/system' | |
52 | + config.colors_palette = :iwanthue # default is :google | |
53 | + config.weight = 500 # default is 300 | |
54 | + config.annotate_position = '-0+10' # default is -0+5 | |
54 | 55 | end |
55 | 56 | ``` |
56 | 57 | ... | ... |
lib/letter_avatar.rb
lib/letter_avatar/avatar.rb
... | ... | @@ -70,20 +70,18 @@ module LetterAvatar |
70 | 70 | |
71 | 71 | filename = fullsize_path(identity) |
72 | 72 | |
73 | - commands = %W( | |
73 | + command = %W( | |
74 | 74 | convert |
75 | - -size 240x240 | |
75 | + -size #{FULLSIZE}x#{FULLSIZE} | |
76 | 76 | xc:#{to_rgb(color)} |
77 | 77 | -pointsize 140 |
78 | 78 | -font #{FONT_FILENAME} |
79 | 79 | -weight #{LetterAvatar.weight} |
80 | 80 | -fill '#{FILL_COLOR}' |
81 | 81 | -gravity Center |
82 | - -annotate -0+5 '#{letter}' | |
82 | + -annotate #{LetterAvatar.annotate_position} '#{letter}' | |
83 | 83 | '#{filename}' |
84 | - ) | |
85 | - | |
86 | - command = commands.join(' ') | |
84 | + ).join(' ') | |
87 | 85 | |
88 | 86 | pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command) |
89 | 87 | Process.waitpid(pid) | ... | ... |
lib/letter_avatar/version.rb