common_element('img', array('src' => $original->url,
'class' => 'avatar original',
'width' => $original->width,
- 'height' => $original->height));
+ 'height' => $original->height,
+ 'alt' => $user->nickname));
}
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
common_element('img', array('src' => $avatar->url,
'class' => 'avatar profile',
'width' => AVATAR_PROFILE_SIZE,
- 'height' => AVATAR_PROFILE_SIZE));
+ 'height' => AVATAR_PROFILE_SIZE,
+ 'alt' => $user->nickname));
}
common_element_start('form', array('enctype' => 'multipart/form-data',
'id' => 'submit',
'value' =>_t('Upload')));
common_element_end('form');
+ common_show_footer();
}
function handle_post() {
$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.'));