summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-05-28 10:42:02 -0400
committerEvan Prodromou <evan@prodromou.name>2008-05-28 10:42:02 -0400
commit84dfd8b52d4c3ce0e0435bf8cbc2a8504e01caa2 (patch)
tree43598ed1a7088b488f89da35f80f54a1638e4e5c
parente0cce107bf148cf4282e8262845b746baec279ce (diff)
don't scale avatar if original already matches size
darcs-hash:20080528144202-84dde-d0f15e4ad4c840816bfadf3b1b57faecdfd401b2.gz
-rw-r--r--actions/avatar.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/actions/avatar.php b/actions/avatar.php
index 7eed48ddb..9c736cd3b 100644
--- a/actions/avatar.php
+++ b/actions/avatar.php
@@ -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