don't scale avatar if original already matches size

darcs-hash:20080528144202-84dde-d0f15e4ad4c840816bfadf3b1b57faecdfd401b2.gz
This commit is contained in:
Evan Prodromou 2008-05-28 10:42:02 -04:00
parent e0cce107bf
commit 84dfd8b52d
1 changed files with 4 additions and 1 deletions

View File

@ -126,7 +126,10 @@ class AvatarAction extends SettingsAction {
$avatar->created = DB_DataObject_Cast::dateTime(); # current time
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
$scaled[] = $this->scale_avatar($user, $avatar, $size);
# We don't need a scaled one if the original is already of that size!
if ($avatar->width != $size && $avatar->height != $size) {
$scaled[] = $this->scale_avatar($user, $avatar, $size);
}
}
# XXX: start a transaction here