From 84dfd8b52d4c3ce0e0435bf8cbc2a8504e01caa2 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 28 May 2008 10:42:02 -0400 Subject: don't scale avatar if original already matches size darcs-hash:20080528144202-84dde-d0f15e4ad4c840816bfadf3b1b57faecdfd401b2.gz --- actions/avatar.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actions') 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 -- cgit v1.2.3-54-g00ecf