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