Commit f7f787da3ab0256a5316d987b9e9cefd9681a6fc

Authored by Caio Almeida
Committed by Larissa Reis
1 parent 0de209fd

Ticket #262: Get profile image

Showing 1 changed file with 5 additions and 6 deletions   Show diff stats
app/models/external_person.rb
... ... @@ -28,7 +28,7 @@ class ExternalPerson < ActiveRecord::Base
28 28 alias :public_profile_url :url
29 29  
30 30 def avatar
31   - "http://#{self.source}/plugin/gravatar_provider/h/#{Digest::MD5.hexdigest(self.email)}"
  31 + "http://#{self.source}/profile/#{self.identifier}/icon/"
32 32 end
33 33  
34 34 def admin_url
... ... @@ -87,12 +87,12 @@ class ExternalPerson < ActiveRecord::Base
87 87 end
88 88  
89 89 class ExternalPerson::Image
90   - attr_accessor :path
91 90 def initialize(path)
92   - self.path = path
  91 + @path = path
93 92 end
  93 +
94 94 def public_filename(size = nil)
95   - self.path
  95 + URI.join(@path, size.to_s)
96 96 end
97 97  
98 98 def content_type
... ... @@ -101,7 +101,6 @@ class ExternalPerson < ActiveRecord::Base
101 101 end
102 102  
103 103 def image
104   - ExternalPerson::Image.new(avatar)
  104 + ExternalPerson::Image.new(path)
105 105 end
106   -
107 106 end
... ...