|
|
@ -16,7 +16,6 @@ import ( |
|
|
|
_ "image/jpeg" |
|
|
|
_ "image/jpeg" |
|
|
|
"image/png" |
|
|
|
"image/png" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"path" |
|
|
|
|
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
"time" |
|
|
@ -211,7 +210,7 @@ func (u *User) GenerateRandomAvatar() error { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("RandomImage: %v", err) |
|
|
|
return fmt.Errorf("RandomImage: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
if err = os.MkdirAll(path.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil { |
|
|
|
if err = os.MkdirAll(filepath.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil { |
|
|
|
return fmt.Errorf("MkdirAll: %v", err) |
|
|
|
return fmt.Errorf("MkdirAll: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
fw, err := os.Create(u.CustomAvatarPath()) |
|
|
|
fw, err := os.Create(u.CustomAvatarPath()) |
|
|
|