move avatar scaling and saving to Avatar and Profile

Extracted the code for setting a new original avatar to the Profile
class, and moved some of it to Avatar, too. This makes it easier to
have the same functionality whether an avatar is set using the profile
settings (for our users), or on a remote subscription. Necessitated
changing the filenaming function to just take an ID.

darcs-hash:20080605193708-84dde-a441cc0474951ce7f1a1da9310b5145c0b7c3070.gz
This commit is contained in:
Evan Prodromou
2008-06-05 15:37:08 -04:00
parent dcc915bd93
commit 56021d9572
6 changed files with 151 additions and 159 deletions

View File

@@ -403,13 +403,13 @@ function common_at_link($sender_id, $nickname) {
// where should the avatar go for this user?
function common_avatar_filename($user, $extension, $size=NULL, $extra=NULL) {
function common_avatar_filename($id, $extension, $size=NULL, $extra=NULL) {
global $config;
if ($size) {
return $user->id . '-' . $size . (($extra) ? ('-' . $extra) : '') . $extension;
return $id . '-' . $size . (($extra) ? ('-' . $extra) : '') . $extension;
} else {
return $user->id . '-original' . (($extra) ? ('-' . $extra) : '') . $extension;
return $id . '-original' . (($extra) ? ('-' . $extra) : '') . $extension;
}
}