Hi everyone.
In this video, let's continue with the upload avatar and cover photos for the users.
And if you remember in the cloudinary we already have a controller for a blog.
Okay?
When we upload we will receive the data and based on the data, we will append us into the avatar and
cover photo over here.
Okay, that's what we want, right?
So let me show you how to do that fully.
I will create the one more thing, uh, with this here.
Um, and we, we, uh, we don't need the row over here.
Let's remove that.
Also, I will create a get sorry post method with the upload avatar.
Ababa.
Right.
And let me copy over here.
Let me just.
Read the current users.
Okay.
And now here we will apply avatar.
Let's create a method for avatar.
Go to the service.
Create method.
Under current users.
Firstly we need to find users.
Okay.
We need to unify former and current user, not one.
And we need to check if no user.
Profile is user profile.
After that we need to create a DTO for our blog.
Okay, now let's say the DTO will be very similar with the post over here.
But here we have something called a blog media video over here.
Right?
And this guy, We should celebrate this thing into another file.
Okay.
I will, uh, move the upload video into the glove box.
Right here.
I will create a little global.
Okay I will.
Move it up.
Cut everything and move it to here.
And let me show you where we need to use the block media video.
And we need to reinvoke that again.
Okay?
We need to remove this.
Epoch.
Uh, block Familiarity.
Rob Glover.
Okay.
That is, I deserve it.
Let's do that.
Over here.
Okay.
So that is.
And we need to remove entire file.
And go to the controller over here.
We need to move the body, which is.
Media.
Block
Like this one.
And put that over here and go up and move that also.
Okay.
And we just need to amend that user dot.
Dot profile.
Sorry dot avatar.
Click the upload media little and away users save and we can return directly over here.
Okay let's test that.
I will Okay.
So the last method and right here we just need to put a little figure inside the body.
Right here we should login first.
After we upgrade we will I will close all the tab and click insert Cloudinary blog file okay.
And insert the file right here.
I will choose the file.
Where we are you choose this thing.
And say.
After us.
We need to copy everything right here and start over here.
Okay, let me say, uh.
Sorry.
Block.
Avatar.
Okay.
After us.
We already got, uh, let me double check inside the database.
So here we already have our data.
Okay.
And in order to respond, we just need to respond the URL.
Okay?
We just need to respond based on the information.
We just need to return the URL for the data okay.
We need to customize that.
Let me show you what it you made in here.
User one user I will have, uh, avatar.
Um, we will stream.
Okay, so how do we do that?
If we remember inside the box, we have a similar method.
This one was little, uh, in here, right click everything from the channel form over here, and I
will put us.
And it brought the transform and muscle with us.
Alright.
We will transform with this information.
Object.
From here we need to replenish inside.
Here we need to return object avatar.
So here.
I'm not showing you the option of changing.
Some stuff like that.
And let me try this again.
Okay.
Right here.
We already got the URL, right.
Let me copy the URL and.
Say.
Okay.
We already got the URL.
Very very good.
Right.
We just need to restart.
Restart the URL.
Okay, actually I will rename a little bit will be after sorry.
We go here.
We got the avatar URL.
Okay.
And uh let me try to get on users okay.
We also have a avatar.
So very very good.
And that is just for the video.
I will see you in the next one.
And, uh, I have a little exercise for you.
Now let's do the similar but for the backgrounds.
Okay.
For a background photo over here and I will see you in the next one.
So down the job.