In this contribution I focused about possibility to upload own avatar. Users have now possibility to add their avatar, this avatar is displaying in their profile and also as their thumbnail in the events which their participated or will be participate. Image is saving on the server and in database is stored information about localization. We dont want to store a full image, because it required a lot of space, so we create a thumbnail from photo, thumbanils is much smaller but quality i very good. User can also update his avatar, after update his old photo is deleted.
creating new service: ImageService, witch has couple of methods, main methods is responsible for take a photo as stream. Then is checking if photo has correct format, I decided also to check a EXIF orientation parameter, because photos made by Samsung Galaxy are often rotated, and if I will save it in original way, they will be displaying in application incorrectly. The rest of the methods are responsible for read image size, resizing, delete old photos and validate image format
methods in profileService witch are responsible for update particular user information about path to his avatar,
method in ProfileController to get avatar by Put method and return the path to user avatar.