|
|
|
@ -138,14 +138,14 @@ public class MyController extends BaseController {
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "3.上传个人头像", notes = "图片压缩为70X70 JPEG,存入S3,桶为indie,目录为 user/avatar/")
|
|
|
|
|
@ApiOperation(value = "3.上传个人头像", notes = "图片存入S3,桶为indie,目录为 user/avatar/")
|
|
|
|
|
@PostMapping("/avatar")
|
|
|
|
|
@GlobalInterceptor(checkAppUserLogin = true)
|
|
|
|
|
public Result<String> uploadAvatar(@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
|
@VerifyParam(required = true) MultipartFile file) throws IOException {
|
|
|
|
|
UserLoginDto userLoginDto = getUserLoginDto(authorization);
|
|
|
|
|
|
|
|
|
|
byte[] thumbnail = ScaleFilter.createThumbnail(file.getInputStream(), Constants.LENGTH_512, Constants.LENGTH_512);
|
|
|
|
|
byte[] thumbnail = file.getBytes();//.createThumbnail(file.getInputStream(), Constants.LENGTH_512, Constants.LENGTH_512);
|
|
|
|
|
String avatarName = userLoginDto.getUserId() + "_" + idWorker.nextId()
|
|
|
|
|
+ StringTools.getFileSuffix(file.getOriginalFilename());
|
|
|
|
|
String filePath = USER_AVATAR_DIRECTORY + avatarName;
|
|
|
|
|