$avatar->url = common_avatar_url($filename);
$avatar->created = DB_DataObject_Cast::dateTime(); # current time
+ $val = $avatar->validate();
+
+ if ($val !== TRUE) {
+ $err = '';
+ foreach ($val as $k=>$v) {
+ $err .= _t('Something wrong with ') . $k;
+ $this->show_form($err);
+ return;
+ }
+ }
+
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
$scaled[] = $this->scale_avatar($user, $avatar, $size);
}
common_server_error(_t('Error deleting old avatars.'));
return;
}
-
if (!$avatar->insert()) {
@unlink($filepath);
common_server_error(_t('Error inserting avatar.'));