$user = common_current_user();
- $filename = common_avatar_filename($user, image_type_to_extension($info[2]));
+ $filename = common_avatar_filename($user, image_type_to_extension($info[2]), NULL, common_timestamp());
$filepath = common_avatar_path($filename);
if (!move_uploaded_file($_FILES['avatarfile']['tmp_name'], $filepath)) {
imagecopyresampled($image_s, $image_a, 0, 0, 0, 0,
$size, $size, $square, $square);
- $ext = ($avatar->mediattype == 'image/jpeg') ? ".jpg" : ".png";
+ $ext = ($avatar->mediattype == 'image/jpeg') ? ".jpeg" : ".png";
- $filename = common_avatar_filename($user, $ext, $size);
+ $filename = common_avatar_filename($user, $ext, $size, common_timestamp());
if ($avatar->mediatype == 'image/jpeg') {
imagejpeg($image_s, common_avatar_path($filename));
// where should the avatar go for this user?
-function common_avatar_filename($user, $extension, $size=NULL) {
+function common_avatar_filename($user, $extension, $size=NULL, $extra=NULL) {
global $config;
if ($size) {
- return $user->id . '-' . $size . $extension;
+ return $user->id . '-' . $size . (($extra) ? $extra : '') . $extension;
} else {
- return $user->id . '-original' . $extension;
+ return $user->id . '-original' . (($extra) ? $extra : '') . $extension;
}
}
return $enc;
}
+function common_timestamp() {
+ return date('YmdHisu');
+}
+
// XXX: set up gettext
function _t($str) {