Laravel User Image
Vložit
- čas přidán 14. 05. 2016
- devdojo.com/ninja - Learn how to create your own Software as a Service in my Ninja Training Program.
devdojo.com/episode/laravel-u... In this video we'll teach you how to add a user profile image in your Laravel App.
Checkout the following repo for the source code: github.com/thedevdojo/laravel...
Great video. It's refreshing to hear someone speaking clear english on Laravel tutorials!
relatable wtf
Ditto!
so true. Im not a native englsih speaker and its sometime hard to understand
All hail devdojo, this is exactly what I was looking for!
Интересный и полезный курс, спасибо большое автору !!!
Thanks very much, love the video Tony. Hope to have more. Keep it coming!
Great channel for novice. Thanks Tony!
Great! It's working perfectly.
I added it to my Laravel best youtube videos playlist ;)
Excellent tutorial. Thanks so much for doing this.
nice tutorial, learned a lot, clear and easy to learn
Worked like a charm ! Thank You.
You make it look so simple thanks :)
Great video , also working in laravel 6 , keep giving like this tutorial
Amazing Tutorial :)
Thank you very much
Thank you so much. You have helped me a lot with this video.
Awesome !
It work, thank you so much guy.
Thang you for the great tutorial! :)
This is very informative and helpful tutorial thanks alot
Awesome! Thank you for sharing!
this was so useful, thanks
This is great! I want to learn more :)
Very helpful. Many thanks.
impressed the way you explained (y)
thanks so much for the video helped alot!!
Nice and beautiful work
Solved the problem ! Thanks!
Allah razı olsun çok işime yaradı.
Thank you :)
this video is very uselful
Great video, thanks.
VERY GOOD,thanks your video
Thanks alot, still working with 5.4!
it is working. thank you dojo 👈
thanks dude, your awesome!
I really wanna thank you for these wonderful tutorials you make. Truly Inspiring.
THANK YOU :)
Bro, please help me
it still shows the image of 09:03.
How did you fix it ?
+Tetike Try not spamming all the users :) Thanks.
+devdojo Sorry :( I just wanted to fix it
forgive mr
Really amazing Thank you
great video !!! you are the best!
Here is a little addition to make it even better .. Just before Image::make($avatar) add the following:
// Delete current image before uploading new image
if ($user->avatar !== 'avatar.png') {
$file = public_path('uploads/avatars/' . $user->avatar);
if (File::exists($file)) {
unlink($file);
}
}
So every time the user uploads a new photo the old one will be deleted for your server
could you show your all your code for this function as it doesn't work for me just keeps deleting the current image , i might have the order in the wrong way as within the if statement , thx
public function updateUserAvatar(Request $request)
{
$user = User::find(Auth::user()->id);
// Handle the user upload of avatar
if ($request->hasFile('avatar')) {
$avatar = $request->file('avatar');
$filename = time() . '.' . $avatar->getClientOriginalExtension();
// Delete current image before uploading new image
if ($user->avatar !== 'default.png') {
// $file = public_path('uploads/avatars/' . $user->avatar);
$file = 'uploads/avatars/' . $user->avatar;
//$destinationPath = 'uploads/' . $id . '/';
if (File::exists($file)) {
unlink($file);
}
}
// Image::make($avatar)->resize(300, 300)->save(public_path('uploads/avatars/' . $filename));
Image::make($avatar)->resize(300, 300)->save('uploads/avatars/' . $filename);
$user = Auth::user();
$user->avatar = $filename;
$user->save();
}
return view('subscription.profile', compact('user'));
}
sorry I just gave you the entire thing ... At least you are able to see where i insert the piece of code (y)
haha na that's fine you fixed my problem which I really appreciate , I only check for user auth in the return method thats' why i was getting an error with the unlink method as i didn't know which user Id to unlink the image , thx
How to use or get User::find ? I have an error that the User controller is not define. Thanks in advance.
Great video !
Thanks! It helps me a lot :) God bless!
this was helpful thanks ^^
Im testing at larevel 5.5 . It works. Thanks & subscribing. A big help for me. The only problem is if you keep pressing the button for a SUBMIT. no image appears.
I have the same problam Sir, have u solved it ?
your contain enctype="multipart/form-data"?
Thank you for this
You are a Star!
this really helped me thanks :) .. keep it up (Y)
Great! Thank You!
Would you be able to create videos on how to add tags from a database onto posts in the newsfeed (like the tags in StackOverflow)?
Great tutorial. Can you make a video on how to crop the uploaded image using jcrop or any other? Because many a times the default aspect ratio is square and user uploads image of some other aspect ratio so by default it gets stretched or something.
Thanks in advance.
Great job
Great video
Hello, ty for the vid, really help me!. i have a question, how can i store the imagen in storage folder, and show it from there? ty in advance
Thankyou broo!🙌
It's works for laravel v5.6!
I'm using Voyager, so `intervention/image` was already installed. Also it stores the photos in `storage\users` folder. Need videos about integration Voyager avatar function and front-end
Thank you so much for this great tutorial. I have small issue, I am working localhost and image path is not correctly written in the mysql db. Sample of the image path in the db "C:\xampp\tmp\phpA49.tmp" can you please help
you are the best
Thanks man
Hey do you have any tutorials on how to make so the main page changes when you log in, for an example i don't want their to be a log in button when i have already logged in. If so i would be greatful!
you are the best!
Bro, please help me
it still shows the image of 09:03
How did you fix it
+Tetike Try not spamming all the users :) Thanks.
Very helpful video and just saying Allah bless you
thank you a lot is working 1000%%%%%%
hello sir i need your help . i want to know how to build the same thing as u have shown but without using any package
How can I possible adapt it to my Laravel CRUD without the Users Auth?
HI! Thank You!
What about adding filetype validation here?
Thx soooo much
Hello Tony,
Nice video!
Woud you know how does Laravel Spark get the cache picture of my gmail? I did not even upload any photo and it brough the image... any tips on that?
Thanks!
Good night Sir Sory Im From indonesia I hope you can help me how to display a flash notification message to a specific time in laravel 5.2
Thanks bro
NotFoundHttpException in RouteCollection.php line 161:
I am keep getting this error does anyone know why ?
Hey devdojo, Could you please tell me how can i link the above tutorial of User's Profile Image with your chatter package..? Thanks in advance :D
hey have you guys done any videos on vue js?
thx for video, very appreciated! btw, probably would be nice to delete avatar from storage when replacing it with new one.
if($user->avatar !== 'avatar.png') {
// if not default avatar
\Storage::disk('avatars')->delete($user->avatar);
}
To create disk you can put it into /config/filesystems.php
'avatars' => [
'driver' => 'local',
'root' => public_path() . '/images/avatars',
// you can have other path
'visibility' => 'public',
],
I have a question. I created a product view with model and controller. then I created a blade template which holds a thumbnail and gets the data obj from product controller. Now when I include my product.blade.php in the welcome.blade.php it covers everyone on my welcome page. If I remove the data obj i can see it display the thumbnail using a simple for loop.
hey bro, thanks for the tutorial, but i have a problem, my avatar didn't update, no error, can you help me?
Nice 👌👌👌👌
Muito bom.
wow ,thanks, suscribe
awesome bro
Bro, please help me.
It still shows me the picture of 09:03
Please tell me how did you fix it
+Tetike Try not spamming all the users :) Thanks.
is that "handsome looking guy" you? :) nice tutorial
which version of laravel you are used????
thx!
soy el único que sabe español acá? jajajaja si lees esto eres el puto amo! gracias...
sir ,
when I try to submit profilr image I am getting this error-
"Call to a member function getClientOriginalExtension() on boolean"
Helo sir
(1/1) NotFoundHttpException
in RouteCollection.php (line 179)
this error occurs while make a profile page
Addition:
You can use exif_read_data() results to rotate the image (for example if you get images from a mobile phone).
Example:
$exif = @exif_read_data($file);
if (isset($exif['Orientation']) && $exif['Orientation'] == '8') {
Image::make($pathTMP)->rotate(90)->save($pathOrg);
}
Thnx
how will I be able to use this in ajax?
am using windows 10 and get this error
Unable to read image from file ().
any suggestions ?
how to delete photos from the folder when the user changes its profile?
THANKYOUUUUUUUUUUUU :'>
please show us how to make a photo galleries, thanks
thks
which error occur when file size is too large
after submit it shows
(1/1) NotWritableException
Can't write image data to path (D:\wamp\www\project\public\/uploads/page/small/1509780886.jpg)
Hi devdojo my submit do nothing, what can i do??
How can I upload each user profile pictures in separate folder, because later it will be a mess...
excuse me sir, what is the syntax theme?
can you make a tutorial again with this topic?
Hi im working in laravel 8 but i cant get the use Image to work, it says its not defined
Are you saving the image in the database?
or youRE saving it in another folder and just saving the file name of the image?
Filename is saved in the database the .jpg itself is saved in the folder '/uploads/avatars' so 'or youRE saving it in another folder and just saving the file name of the image?'
why the default.jpg images can not show ??
Been Trying this several time for the user registration page but every time i try i keep getting this error message "Call to a member function hasFile() on array" and am kind of stuck kindly help please
Hello sir,
I have performed all the steps which you telling us but at profile upload it not working it gives a error like
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException