Laravel User Image

Поделиться
HTML-код
  • Опубликовано: 14 май 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...

Комментарии • 189

  • @slaction
    @slaction 7 лет назад +56

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

    • @hugojose12
      @hugojose12 4 года назад +2

      relatable wtf

    • @shaneholmes6218
      @shaneholmes6218 4 года назад

      Ditto!

    • @albi3235
      @albi3235 2 года назад +1

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

  • @SidDefinition
    @SidDefinition 8 лет назад

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

  • @freemqwer
    @freemqwer 8 лет назад

    Great channel for novice. Thanks Tony!

  • @fajoe5757
    @fajoe5757 7 лет назад

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

  • @MasterJ0n
    @MasterJ0n 8 лет назад

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

  • @befuture_ru
    @befuture_ru 8 лет назад +2

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

  • @Brocollipy
    @Brocollipy 7 лет назад

    Excellent tutorial. Thanks so much for doing this.

  • @yiyuxu9416
    @yiyuxu9416 7 лет назад

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

  • @ismaila2790
    @ismaila2790 5 лет назад

    Worked like a charm ! Thank You.

  • @collinsodeny
    @collinsodeny 5 лет назад

    You make it look so simple thanks :)

  • @tulsirammarasini3352
    @tulsirammarasini3352 4 года назад +1

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

  • @rodrigopastl
    @rodrigopastl 2 года назад

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

  • @bilalfarhat5169
    @bilalfarhat5169 7 лет назад

    Amazing Tutorial :)
    Thank you very much

  • @shaneholmes6218
    @shaneholmes6218 4 года назад

    Awesome! Thank you for sharing!

  • @angelitohizon1459
    @angelitohizon1459 7 лет назад

    This is great! I want to learn more :)

  • @faizanalishah7769
    @faizanalishah7769 6 лет назад

    This is very informative and helpful tutorial thanks alot

  • @jorgeperalta9780
    @jorgeperalta9780 3 года назад +1

    this was so useful, thanks

  • @sopheakchan4518
    @sopheakchan4518 5 лет назад

    Awesome !
    It work, thank you so much guy.

  • @tahiriqbal8543
    @tahiriqbal8543 5 лет назад +1

    impressed the way you explained (y)

  • @Ajuchacko91
    @Ajuchacko91 8 лет назад

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

    • @tetike4753
      @tetike4753 8 лет назад

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

    • @Devdojo
      @Devdojo  8 лет назад

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

    • @tetike4753
      @tetike4753 8 лет назад

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

  • @NathanGeerinck
    @NathanGeerinck 8 лет назад

    Thang you for the great tutorial! :)

  • @Askbowe
    @Askbowe 8 лет назад +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 8 лет назад

      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 8 лет назад +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 8 лет назад +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 8 лет назад +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 7 лет назад

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

  • @MsPoitras
    @MsPoitras 7 лет назад

    Thanks alot, still working with 5.4!

  • @arbnorsalihu3161
    @arbnorsalihu3161 7 лет назад

    Very helpful. Many thanks.

  • @Rahidt100
    @Rahidt100 5 лет назад

    Solved the problem ! Thanks!

  • @MouayedElhak
    @MouayedElhak 8 лет назад

    Nice and beautiful work

  • @ismailcemaltekin5435
    @ismailcemaltekin5435 3 года назад

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

  • @davismaghanga1935
    @davismaghanga1935 5 лет назад

    thanks so much for the video helped alot!!

  • @manojpriyamantha
    @manojpriyamantha 4 года назад

    it is working. thank you dojo 👈

  • @ruicary9899
    @ruicary9899 8 лет назад

    VERY GOOD,thanks your video

  • @info-ternak01
    @info-ternak01 7 лет назад

    Great video, thanks.

  • @MozahidRanaRasel
    @MozahidRanaRasel 7 лет назад

    Thank you :)
    this video is very uselful

  • @blackoutgo2597
    @blackoutgo2597 8 лет назад

    thanks dude, your awesome!

  • @malumc4228
    @malumc4228 5 лет назад

    great video !!! you are the best!

  • @igoralves1
    @igoralves1 5 лет назад

    Great video !

  • @Murang_pabahay
    @Murang_pabahay 7 лет назад

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

  • @koraygurleyen5140
    @koraygurleyen5140 6 лет назад

    Really amazing Thank you

  • @shohanhossain8280
    @shohanhossain8280 7 лет назад

    You are a Star!

  • @wassimbensassi7757
    @wassimbensassi7757 6 лет назад

    this was helpful thanks ^^

  • @bilaltariq839
    @bilaltariq839 8 лет назад

    Thank you for this

  • @ahmedmagdy6339
    @ahmedmagdy6339 8 лет назад

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

  • @subhadeepchowdhury9065
    @subhadeepchowdhury9065 5 лет назад

    Great job

  • @loremipsum574
    @loremipsum574 6 лет назад +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.

  • @AmaroAmaral
    @AmaroAmaral 5 лет назад

    Great! Thank You!

  • @icanhc
    @icanhc 8 лет назад +2

    you are the best!

    • @tetike4753
      @tetike4753 8 лет назад

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

    • @Devdojo
      @Devdojo  8 лет назад

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

  • @kelvingachiri942
    @kelvingachiri942 7 лет назад

    Great video

  • @kopihitam12333
    @kopihitam12333 5 месяцев назад

    Thankyou broo!🙌

  • @sometimesplay1439
    @sometimesplay1439 5 лет назад

    It's works for laravel v5.6!

  • @jaymztrack
    @jaymztrack 6 лет назад +2

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

  • @ahmadlatif2047
    @ahmadlatif2047 5 лет назад

    Very helpful video and just saying Allah bless you

  • @5Gamingx
    @5Gamingx 4 года назад

    Thanks man

  • @davidkahdze3474
    @davidkahdze3474 8 лет назад

    you are the best

  • @molkamoussi1382
    @molkamoussi1382 3 года назад

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

  • @nestromae
    @nestromae 5 лет назад +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',
    ],

  • @SXsoft99
    @SXsoft99 8 лет назад

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

  • @JeetDholakia
    @JeetDholakia 8 лет назад

    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.

  • @rajaouachani8485
    @rajaouachani8485 5 лет назад

    Thx soooo much

  • @elyselys9367
    @elyselys9367 5 лет назад

    Thanks bro

  • @amitsonar3511
    @amitsonar3511 7 лет назад

    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

  • @CX6998
    @CX6998 8 лет назад

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

  • @rayhan5768
    @rayhan5768 6 лет назад

    Nice 👌👌👌👌

  • @sabmus
    @sabmus 8 лет назад

    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

  • @NatanMelonatan
    @NatanMelonatan 7 лет назад

    Muito bom.

  • @nipunasudha
    @nipunasudha 8 лет назад

    awesome bro

    • @tetike4753
      @tetike4753 8 лет назад

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

    • @Devdojo
      @Devdojo  8 лет назад

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

  • @bogdanz
    @bogdanz 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

  • @jcesarqg6358
    @jcesarqg6358 8 лет назад

    wow ,thanks, suscribe

  • @Mohamud258
    @Mohamud258 8 лет назад

    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

  • @fusion5329
    @fusion5329 8 лет назад

    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!

  • @Volnianskii
    @Volnianskii 3 года назад

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

  • @icacahyani9234
    @icacahyani9234 7 лет назад

    thx!

  • @lespaulmendiolaii390
    @lespaulmendiolaii390 5 лет назад +2

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

  • @carstenjobmann6249
    @carstenjobmann6249 7 лет назад

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

  • @EvertRamos
    @EvertRamos 8 лет назад

    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!

  • @judgementday2022
    @judgementday2022 7 лет назад

    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.

  • @ahmedragab4063
    @ahmedragab4063 2 года назад

    Thnx

  • @hometown-flavors
    @hometown-flavors 6 лет назад

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

  • @rohmatmret8265
    @rohmatmret8265 8 лет назад

    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

  • @samdeacon7910
    @samdeacon7910 5 лет назад

    hey have you guys done any videos on vue js?

  • @muhammadabduhsiregar9190
    @muhammadabduhsiregar9190 6 лет назад

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

  • @fnusaba7128
    @fnusaba7128 7 лет назад +1

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

  • @aslanaitkulov506
    @aslanaitkulov506 5 лет назад

    thks

  • @KaushikPoojari
    @KaushikPoojari 7 лет назад

    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

  • @hometown-flavors
    @hometown-flavors 5 лет назад

    which error occur when file size is too large

  • @elmomahupil
    @elmomahupil 3 года назад

    THANKYOUUUUUUUUUUUU :'>

  • @YasirMalik24
    @YasirMalik24 6 лет назад

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

  • @dzyof
    @dzyof 7 лет назад

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

  • @puneethp537
    @puneethp537 6 лет назад

    which version of laravel you are used????

  • @mehmetmunaf3610
    @mehmetmunaf3610 7 лет назад

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

  • @abdb7174
    @abdb7174 7 лет назад

    please show us how to make a photo galleries, thanks

  • @leadit7848
    @leadit7848 5 лет назад

    how will I be able to use this in ajax?

  • @erielchavez9752
    @erielchavez9752 7 лет назад

    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 6 лет назад

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

  • @nageshbk1
    @nageshbk1 6 лет назад +1

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

  • @najmihamdi9267
    @najmihamdi9267 4 года назад

    i got problem.. why your code got looping.. if user return view to profile page again and when they click button refresh it will submit again and then the image upload will upload again. when click refresh it will detech resubmision form.. why?

  • @firojkhan-kv1ew
    @firojkhan-kv1ew 6 лет назад

    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

  • @letecianaquines5743
    @letecianaquines5743 4 года назад

    can you make a tutorial again with this topic?

  • @rogermartinez9566
    @rogermartinez9566 3 года назад

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

  • @guilhermemoraes4055
    @guilhermemoraes4055 2 года назад

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

  • @adekunleabiodunquadri8442
    @adekunleabiodunquadri8442 7 лет назад

    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

  • @user-oy2qh6hr5h
    @user-oy2qh6hr5h 7 лет назад

    update_avatar doesnt work in my app
    when i change the default avatar nothing appears

  • @usamakhalid1990
    @usamakhalid1990 7 лет назад

    Class 'Image' not found error. Please help me resolve this. And i am using laravel 5.3