Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added experimental support for local avatars.
Put png files in data/local_avatars rather than load them from a web service.
- Loading branch information
Showing
5 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
import java.io.File; | |||
|
|||
public class LocalAvatar extends AvatarFetcher { | |||
public String dir = ""; | |||
public String empty_pic = null; | |||
|
|||
public LocalAvatar(CodeSwarmConfig cfg) { | |||
super(cfg); | |||
dir = cfg.getStringProperty("LocalAvatarDirectory"); | |||
empty_pic = cfg.getStringProperty("LocalAvatarDefaultPic"); | |||
} | |||
|
|||
public String fetchUserImage(String username) { | |||
String filename = dir+username+".png"; | |||
File f = new File(filename); | |||
if(f.exists()) return filename; | |||
return dir+empty_pic; | |||
} | |||
|
|||
|
|||
} |