Laravel User Image

Sdílet
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...

Komentáře • 189

  • @slaction
    @slaction Před 8 lety +56

    Great video. It's refreshing to hear someone speaking clear english on Laravel tutorials!

    • @hugojose12
      @hugojose12 Před 4 lety +2

      relatable wtf

    • @shaneholmes6218
      @shaneholmes6218 Před 4 lety

      Ditto!

    • @albi3235
      @albi3235 Před 2 lety +1

      so true. Im not a native englsih speaker and its sometime hard to understand

  • @SidDefinition
    @SidDefinition Před 8 lety

    All hail devdojo, this is exactly what I was looking for!

  • @befuture_ru
    @befuture_ru Před 8 lety +2

    Интересный и полезный курс, спасибо большое автору !!!

  • @MasterJ0n
    @MasterJ0n Před 8 lety

    Thanks very much, love the video Tony. Hope to have more. Keep it coming!

  • @freemqwer
    @freemqwer Před 8 lety

    Great channel for novice. Thanks Tony!

  • @fajoe5757
    @fajoe5757 Před 7 lety

    Great! It's working perfectly.
    I added it to my Laravel best youtube videos playlist ;)

  • @Brocollipy
    @Brocollipy Před 7 lety

    Excellent tutorial. Thanks so much for doing this.

  • @yiyuxu9416
    @yiyuxu9416 Před 7 lety

    nice tutorial, learned a lot, clear and easy to learn

  • @ismaila2790
    @ismaila2790 Před 5 lety

    Worked like a charm ! Thank You.

  • @collinsodeny
    @collinsodeny Před 6 lety

    You make it look so simple thanks :)

  • @tulsirammarasini3352
    @tulsirammarasini3352 Před 4 lety +1

    Great video , also working in laravel 6 , keep giving like this tutorial

  • @bilalfarhat5169
    @bilalfarhat5169 Před 7 lety

    Amazing Tutorial :)
    Thank you very much

  • @rodrigopastl
    @rodrigopastl Před 2 lety

    Thank you so much. You have helped me a lot with this video.

  • @sopheakchan4518
    @sopheakchan4518 Před 5 lety

    Awesome !
    It work, thank you so much guy.

  • @NathanGeerinck
    @NathanGeerinck Před 8 lety

    Thang you for the great tutorial! :)

  • @faizanalishah7769
    @faizanalishah7769 Před 6 lety

    This is very informative and helpful tutorial thanks alot

  • @shaneholmes6218
    @shaneholmes6218 Před 4 lety

    Awesome! Thank you for sharing!

  • @jorgeperalta9780
    @jorgeperalta9780 Před 3 lety +1

    this was so useful, thanks

  • @angelitohizon1459
    @angelitohizon1459 Před 7 lety

    This is great! I want to learn more :)

  • @arbnorsalihu3161
    @arbnorsalihu3161 Před 7 lety

    Very helpful. Many thanks.

  • @tahiriqbal8543
    @tahiriqbal8543 Před 5 lety +1

    impressed the way you explained (y)

  • @davismaghanga1935
    @davismaghanga1935 Před 5 lety

    thanks so much for the video helped alot!!

  • @MouayedElhak
    @MouayedElhak Před 8 lety

    Nice and beautiful work

  • @Rahidt100
    @Rahidt100 Před 5 lety

    Solved the problem ! Thanks!

  • @ismailcemaltekin5435
    @ismailcemaltekin5435 Před 3 lety

    Allah razı olsun çok işime yaradı.

  • @MozahidRanaRasel
    @MozahidRanaRasel Před 7 lety

    Thank you :)
    this video is very uselful

  • @info-ternak01
    @info-ternak01 Před 7 lety

    Great video, thanks.

  • @ruicary9899
    @ruicary9899 Před 8 lety

    VERY GOOD,thanks your video

  • @MsPoitras
    @MsPoitras Před 7 lety

    Thanks alot, still working with 5.4!

  • @manojpriyamantha
    @manojpriyamantha Před 4 lety

    it is working. thank you dojo 👈

  • @blackoutgo2597
    @blackoutgo2597 Před 8 lety

    thanks dude, your awesome!

  • @Ajuchacko91
    @Ajuchacko91 Před 8 lety

    I really wanna thank you for these wonderful tutorials you make. Truly Inspiring.
    THANK YOU :)

    • @tetike4753
      @tetike4753 Před 8 lety

      Bro, please help me
      it still shows the image of 09:03.
      How did you fix it ?

    • @Devdojo
      @Devdojo  Před 8 lety

      +Tetike Try not spamming all the users :) Thanks.

    • @tetike4753
      @tetike4753 Před 8 lety

      +devdojo Sorry :( I just wanted to fix it
      forgive mr

  • @koraygurleyen5140
    @koraygurleyen5140 Před 6 lety

    Really amazing Thank you

  • @malumc4228
    @malumc4228 Před 5 lety

    great video !!! you are the best!

  • @Askbowe
    @Askbowe Před 8 lety +27

    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

    • @Sam-ih7xv
      @Sam-ih7xv Před 8 lety

      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

    • @Askbowe
      @Askbowe Před 8 lety +3

      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'));
      }

    • @Askbowe
      @Askbowe Před 8 lety +1

      sorry I just gave you the entire thing ... At least you are able to see where i insert the piece of code (y)

    • @Sam-ih7xv
      @Sam-ih7xv Před 8 lety +1

      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

    • @royansyt804
      @royansyt804 Před 7 lety

      How to use or get User::find ? I have an error that the User controller is not define. Thanks in advance.

  • @igoralves1
    @igoralves1 Před 5 lety

    Great video !

  • @Murang_pabahay
    @Murang_pabahay Před 7 lety

    Thanks! It helps me a lot :) God bless!

  • @wassimbensassi7757
    @wassimbensassi7757 Před 6 lety

    this was helpful thanks ^^

  • @loremipsum574
    @loremipsum574 Před 6 lety +1

    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.

  • @bilaltariq839
    @bilaltariq839 Před 8 lety

    Thank you for this

  • @shohanhossain8280
    @shohanhossain8280 Před 7 lety

    You are a Star!

  • @ahmedmagdy6339
    @ahmedmagdy6339 Před 8 lety

    this really helped me thanks :) .. keep it up (Y)

  • @AmaroAmaral
    @AmaroAmaral Před 5 lety

    Great! Thank You!

  • @CX6998
    @CX6998 Před 8 lety

    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)?

  • @JeetDholakia
    @JeetDholakia Před 8 lety

    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.

  • @subhadeepchowdhury9065

    Great job

  • @kelvingachiri942
    @kelvingachiri942 Před 7 lety

    Great video

  • @sabmus
    @sabmus Před 8 lety

    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

  • @kopihitam12333
    @kopihitam12333 Před 5 měsíci

    Thankyou broo!🙌

  • @sometimesplay1439
    @sometimesplay1439 Před 6 lety

    It's works for laravel v5.6!

  • @bogdanz
    @bogdanz Před 6 lety

    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

  • @Mohamud258
    @Mohamud258 Před 8 lety

    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

  • @davidkahdze3474
    @davidkahdze3474 Před 8 lety

    you are the best

  • @5Gamingx
    @5Gamingx Před 4 lety

    Thanks man

  • @fusion5329
    @fusion5329 Před 8 lety

    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!

  • @icanhc
    @icanhc Před 8 lety +2

    you are the best!

    • @tetike4753
      @tetike4753 Před 8 lety

      Bro, please help me
      it still shows the image of 09:03
      How did you fix it

    • @Devdojo
      @Devdojo  Před 8 lety

      +Tetike Try not spamming all the users :) Thanks.

  • @ahmadlatif2047
    @ahmadlatif2047 Před 5 lety

    Very helpful video and just saying Allah bless you

  • @molkamoussi1382
    @molkamoussi1382 Před 3 lety

    thank you a lot is working 1000%%%%%%

  • @amitsonar3511
    @amitsonar3511 Před 7 lety

    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

  • @lespaulmendiolaii390
    @lespaulmendiolaii390 Před 5 lety +2

    How can I possible adapt it to my Laravel CRUD without the Users Auth?

  • @Volnianskii
    @Volnianskii Před 3 lety

    HI! Thank You!
    What about adding filetype validation here?

  • @rajaouachani8485
    @rajaouachani8485 Před 5 lety

    Thx soooo much

  • @EvertRamos
    @EvertRamos Před 8 lety

    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!

  • @rohmatmret8265
    @rohmatmret8265 Před 8 lety

    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

  • @elyselys9367
    @elyselys9367 Před 6 lety

    Thanks bro

  • @fnusaba7128
    @fnusaba7128 Před 7 lety +1

    NotFoundHttpException in RouteCollection.php line 161:
    I am keep getting this error does anyone know why ?

  • @KaushikPoojari
    @KaushikPoojari Před 7 lety

    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

  • @samdeacon7910
    @samdeacon7910 Před 6 lety

    hey have you guys done any videos on vue js?

  • @nestromae
    @nestromae Před 5 lety +2

    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',
    ],

  • @judgementday2022
    @judgementday2022 Před 7 lety

    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.

  • @muhammadabduhsiregar9190

    hey bro, thanks for the tutorial, but i have a problem, my avatar didn't update, no error, can you help me?

  • @rayhan5768
    @rayhan5768 Před 6 lety

    Nice 👌👌👌👌

  • @NatanMelonatan
    @NatanMelonatan Před 7 lety

    Muito bom.

  • @jcesarqg6358
    @jcesarqg6358 Před 8 lety

    wow ,thanks, suscribe

  • @nipunasudha
    @nipunasudha Před 8 lety

    awesome bro

    • @tetike4753
      @tetike4753 Před 8 lety

      Bro, please help me.
      It still shows me the picture of 09:03
      Please tell me how did you fix it

    • @Devdojo
      @Devdojo  Před 8 lety

      +Tetike Try not spamming all the users :) Thanks.

  • @SXsoft99
    @SXsoft99 Před 8 lety

    is that "handsome looking guy" you? :) nice tutorial

  • @puneethp537
    @puneethp537 Před 6 lety

    which version of laravel you are used????

  • @icacahyani9234
    @icacahyani9234 Před 7 lety

    thx!

  • @jaymztrack
    @jaymztrack Před 6 lety +2

    soy el único que sabe español acá? jajajaja si lees esto eres el puto amo! gracias...

  • @nageshbk1
    @nageshbk1 Před 6 lety +1

    sir ,
    when I try to submit profilr image I am getting this error-
    "Call to a member function getClientOriginalExtension() on boolean"

  • @hometown-flavors
    @hometown-flavors Před 6 lety

    (1/1) NotFoundHttpException
    in RouteCollection.php (line 179)
    this error occurs while make a profile page

  • @carstenjobmann6249
    @carstenjobmann6249 Před 7 lety

    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);
    }

  • @ahmedragab4063
    @ahmedragab4063 Před 3 lety

    Thnx

  • @leadit7848
    @leadit7848 Před 5 lety

    how will I be able to use this in ajax?

  • @mehmetmunaf3610
    @mehmetmunaf3610 Před 7 lety

    am using windows 10 and get this error
    Unable to read image from file ().
    any suggestions ?

  • @dzyof
    @dzyof Před 7 lety

    how to delete photos from the folder when the user changes its profile?

  • @elmomahupil
    @elmomahupil Před 3 lety

    THANKYOUUUUUUUUUUUU :'>

  • @abdb7174
    @abdb7174 Před 7 lety

    please show us how to make a photo galleries, thanks

  • @aslanaitkulov506
    @aslanaitkulov506 Před 5 lety

    thks

  • @hometown-flavors
    @hometown-flavors Před 5 lety

    which error occur when file size is too large

  • @YasirMalik24
    @YasirMalik24 Před 6 lety

    after submit it shows
    (1/1) NotWritableException
    Can't write image data to path (D:\wamp\www\project\public\/uploads/page/small/1509780886.jpg)

  • @vardgeskeshishyan380
    @vardgeskeshishyan380 Před 7 lety

    Hi devdojo my submit do nothing, what can i do??

  • @guilhermemoraes4055
    @guilhermemoraes4055 Před 3 lety

    How can I upload each user profile pictures in separate folder, because later it will be a mess...

  • @abdi_pie7266
    @abdi_pie7266 Před 4 lety

    excuse me sir, what is the syntax theme?

  • @letecianaquines5743
    @letecianaquines5743 Před 5 lety

    can you make a tutorial again with this topic?

  • @rogermartinez9566
    @rogermartinez9566 Před 3 lety

    Hi im working in laravel 8 but i cant get the use Image to work, it says its not defined

  • @erielchavez9752
    @erielchavez9752 Před 7 lety

    Are you saving the image in the database?
    or youRE saving it in another folder and just saving the file name of the image?

    • @xanthos733
      @xanthos733 Před 7 lety

      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?'

  • @zhichengyu950
    @zhichengyu950 Před 6 lety

    why the default.jpg images can not show ??

  • @adekunleabiodunquadri8442

    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

  • @firojkhan-kv1ew
    @firojkhan-kv1ew Před 6 lety

    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