Commit 0df73e95fb4fbf671264a3792c89c00b65962fc2

Authored by Krzysiek Szczuka
1 parent e40515be
Exists in master

more options configurable, version bumped

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
... ... @@ -13,6 +13,9 @@ module LetterAvatar
13 13 mattr_accessor :weight
14 14 @@weight = 300
15 15  
  16 + mattr_accessor :annotate_position
  17 + @@annotate_position = '-0+5'
  18 +
16 19 def self.setup(&block)
17 20 yield(self)
18 21 end
... ...
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
1 1 module LetterAvatar
2   - VERSION = "0.1.6"
  2 + VERSION = "0.1.7"
3 3 end
... ...