How To Load Images Like A Pro

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 มิ.ย. 2024
  • Lazy Load Images Article: blog.webdevsimplified.com/202...
    Images are the largest asset for most sites and the biggest cause for unresponsive, laggy sites. In this video I will show you how to use lazy loading to not only drastically speed up your applications, but to also increase the polish and quality of your site.
    📚 Materials/References:
    Lazy Load Images Article: blog.webdevsimplified.com/202...
    Responsive Images Video: • Make Your Site Lightni...
    Responsive Images Article: blog.webdevsimplified.com/202...
    🌎 Find Me Here:
    My Blog: blog.webdevsimplified.com
    My Courses: courses.webdevsimplified.com
    Patreon: / webdevsimplified
    Twitter: / devsimplified
    Discord: / discord
    GitHub: github.com/WebDevSimplified
    CodePen: codepen.io/WebDevSimplified
    ⏱️ Timestamps:
    00:00 - Introduction
    00:35 - What Is The Problem
    02:17 - Lazy Loading Basics
    05:15 - Advanced Blurry Loading
    #LazyLoading #WDS #HTML

ความคิดเห็น • 358

  • @snc0lt
    @snc0lt ปีที่แล้ว +486

    one of the things i like about you, is that you rarely use any framework/library for your videos and just focused on the fundamentals...! Keep it up.!

    • @TheThirdWorldCitizen
      @TheThirdWorldCitizen ปีที่แล้ว +12

      He does talk a lot about react tbf, but decent amount of vanilla videos.

    • @cookieman.19
      @cookieman.19 9 หลายเดือนก่อน +7

      He is the framework

    • @MrThebigcheese75
      @MrThebigcheese75 7 หลายเดือนก่อน

      I agree, prefer not to be bogged down with a framework, for what I do they're overkill.

    • @fatimanura6359
      @fatimanura6359 4 หลายเดือนก่อน

      yup, it helps to have more better understand, and get used to the logics

  • @rusicsemenov
    @rusicsemenov ปีที่แล้ว +23

    Hi Kail, thanks, good idea with pulse. And you can write in the keyframes 0%, 100% ... and 50%, instead repeat the same code.

  • @MrMikopi
    @MrMikopi 11 หลายเดือนก่อน +5

    I'm not that into front end side,
    But video making of yours is brilliant!
    I've even checked if I increased playback speed, but no, it was you talking at a good amount of speed, talking only about important stuff.
    Visual demonstrations are on point also.
    Thank you, good work.
    Edit: 11:36 that is the fastest bug fixing I've ever seen haha

  • @Diventurer
    @Diventurer ปีที่แล้ว

    Did not know about the loading attribute. It was very helpful for a website I develop. Thank you!

  • @SnappyScience
    @SnappyScience ปีที่แล้ว

    Great easy to follow vid. The blur background idea is gold.

  • @JonHaa87
    @JonHaa87 11 หลายเดือนก่อน +63

    1. I'd add an additional blur filter to the low res images, either in the browser or when generating them. Just upscaling them kinda makes them look crappy as you get lots of "square gradients" (for a lack of a better word) interpolating between the pixels instead of a nice smooth blurry version.
    2. As other have said, this effect is mostly already implemented into browsers/images. If you'd save the images as progressive, they'd automatically get sharper and sharper while they load, which requires less code and doesn't even need the download of the small image versions. However you could implement an additional blur effect on top of that while they're loading for a better effect, similar to what you've done in the video.
    3. The solution you've given in the video is bad as someone with scripts disabled won't see the high-res versions at all. I'd add the CSS class that hides them until they're loaded also within JS.

  • @arinqwerty
    @arinqwerty 7 หลายเดือนก่อน

    I love how this is detailed!!!

  • @RobertWildling
    @RobertWildling 8 หลายเดือนก่อน

    Excellent video! Incredibly well explained, exceptionally well prepared! Thank you very much!

  • @TheNewton
    @TheNewton ปีที่แล้ว +7

    8:12 in addition to online tools most image asset CDN's have parameters , or a path, to serve specific image sizes.

  • @leandrolepingo1783
    @leandrolepingo1783 11 หลายเดือนก่อน

    Hi Kail, thanks, good idea with pulse.

  • @CodeCowboy64
    @CodeCowboy64 10 หลายเดือนก่อน +1

    Been in web dev for 25 years, been a few since I was doing front end stuff. TIL some new to me properties, thanks!

  • @Gio-m
    @Gio-m 11 หลายเดือนก่อน

    Dude you're a blessing, thank you!

  • @OldManBears
    @OldManBears 7 หลายเดือนก่อน

    You're awesome, this was incredibly helpful.

  • @MichaelKadzioch
    @MichaelKadzioch 11 หลายเดือนก่อน

    Thanks for this Video!

  • @martinkarugaba
    @martinkarugaba ปีที่แล้ว

    Awesome tutorial, thanks Kyle.

  • @user-fs6qz7be2z
    @user-fs6qz7be2z ปีที่แล้ว

    I was looking for EXACTLY this for my project.

  • @eliyahutarab4862
    @eliyahutarab4862 ปีที่แล้ว

    Amazing as always thank you so much man

  • @JoseLeMalin
    @JoseLeMalin หลายเดือนก่อน

    Very usefull video ! Thank you !

  • @CarlosHernandez-tg3vj
    @CarlosHernandez-tg3vj ปีที่แล้ว

    exactly what I needed thank you

  • @prodbybarn
    @prodbybarn ปีที่แล้ว

    Just what i was looking for, awesome

  • @BorisBarroso
    @BorisBarroso ปีที่แล้ว +1

    Thanks this is so useful, I have started a e-commerce site and I will use this method for the product images

    • @lamhung4899
      @lamhung4899 ปีที่แล้ว

      this method is more suite for showcase , img attribute srcset is better enough for your ecom site

  • @user-uk1bx9vm4o
    @user-uk1bx9vm4o ปีที่แล้ว

    The process of generating and storing the blue placeholder js cumbersome - cloudinary really makes the whole thing a lot more cleaner.

  • @krumbo
    @krumbo 11 หลายเดือนก่อน

    Great stuff thanks for sharing.

  • @landau07
    @landau07 11 หลายเดือนก่อน

    Great content! Thank you!

  • @colindante5164
    @colindante5164 ปีที่แล้ว

    Thankyou much for sharing this awesome technique. ))))

  • @stevensavoie856
    @stevensavoie856 ปีที่แล้ว +6

    I love that the way you add lazy loading is how non-programmers think writing code is like.
    "If you want lazy loading, type "loading = lazy". If you want a visitor to buy things, just add a button and write "action = complete transaction with credit card or payment service.""

    • @tantalus_complex
      @tantalus_complex 10 หลายเดือนก่อน

      That's the Declarative Paradigm of programming for you. It's all about letting you describe WHAT you want (leaving the HOW to the engine).
      That is, you provide descriptions of what you want, piece by piece.
      On the other hand, what people casually mean by "programming" tends to be the Imperative Paradigm. This is all about letting you describe HOW you want things done.
      That is, you provide instructions, step by step.

  • @andreaskarz
    @andreaskarz 10 หลายเดือนก่อน

    Super cool, thank you

  • @derpysean1072
    @derpysean1072 ปีที่แล้ว

    This is nice. Thank you dude.

  • @kennethbeal
    @kennethbeal ปีที่แล้ว

    Nice, thank you!

  • @khalidelgazzar
    @khalidelgazzar 11 หลายเดือนก่อน

    Grest tutorial. Thank you

  • @eseval
    @eseval ปีที่แล้ว

    Great video. Thanks.

  • @mohmarroun3189
    @mohmarroun3189 2 หลายเดือนก่อน

    Great video!

  • @dotjs5025
    @dotjs5025 ปีที่แล้ว

    Simply amazing explanation

  • @user-mi5sy1wq9v
    @user-mi5sy1wq9v 11 หลายเดือนก่อน

    you are such a genius!!

  • @iamasifimam
    @iamasifimam 11 หลายเดือนก่อน

    very helpfull content thankyou for sharing this.

  • @OrlandoVallejos
    @OrlandoVallejos 10 หลายเดือนก่อน

    Amazing content!

  • @yalewjemberu6821
    @yalewjemberu6821 7 หลายเดือนก่อน

    Your are the life saver....the (img.complete) one

  • @kenansenagic384
    @kenansenagic384 10 หลายเดือนก่อน

    Great advice :)

  • @ibtesumrezaaninda323
    @ibtesumrezaaninda323 9 หลายเดือนก่อน

    Ow man! You are awesome!

  • @krateskim4169
    @krateskim4169 11 หลายเดือนก่อน

    That was amazing

  • @GergelyCsermely
    @GergelyCsermely 10 หลายเดือนก่อน

    Thanks!

  • @whonayem01
    @whonayem01 ปีที่แล้ว

    That's awesome!

  • @mrnabby4178
    @mrnabby4178 ปีที่แล้ว

    I was waiting for this video.

  • @minusgod
    @minusgod ปีที่แล้ว

    Thank you for this very informative video .. pls do make a video for video loading time will be very helpful :)

  • @temperkan3727
    @temperkan3727 ปีที่แล้ว +2

    This guy is awesome!

  • @javascript_developer
    @javascript_developer ปีที่แล้ว

    nice tricks to load images thanks for sharing.

  • @eksperiment6269
    @eksperiment6269 ปีที่แล้ว +1

    This is an awesome way to load images. Great video!

    • @khanapeena2191
      @khanapeena2191 13 ชั่วโมงที่ผ่านมา

      It's better to use library for that

  • @namikazedevj46
    @namikazedevj46 ปีที่แล้ว

    what a coincidence got this issue in my job task xD thanks a lot!

  • @PeriklesPeriklesoglu
    @PeriklesPeriklesoglu 6 หลายเดือนก่อน

    thank you

  • @BloodyScythe666
    @BloodyScythe666 ปีที่แล้ว +1

    nice video! one thing I'd have done differently is, if you're using javascript anyways, I'd have set the small image style in the script itself too, to have the DOM be less cluttered

    • @SenselessUsername
      @SenselessUsername 7 หลายเดือนก่อน

      Also to make the no-scripts users see the actual picture eventually...

  • @allenzhao5216
    @allenzhao5216 10 หลายเดือนก่อน +1

    The issue with this puts more load on the user and the server. You're loading multiple images at the end of the day. I would love to see if there could be a version where it automatically downscales itself, and builds upon itself. Great video!

    • @cool_scatter
      @cool_scatter 6 หลายเดือนก่อน

      The "load" of a

  • @rabihmaroun225
    @rabihmaroun225 ปีที่แล้ว

    Very useful. King.

  • @debugpro
    @debugpro ปีที่แล้ว

    thats what i want thanks very much i had same porblem in my real portfolio

  • @sunraiii
    @sunraiii ปีที่แล้ว +9

    Web development wouldn't be where it's at without TH-cam. Great video!

    • @calimio6
      @calimio6 ปีที่แล้ว +4

      nah, without content creators

    • @rproctor83
      @rproctor83 ปีที่แล้ว +3

      @@calimio6 nah, without internet

    • @merlinwarage
      @merlinwarage 11 หลายเดือนก่อน +1

      Did you ever hear about books? Or sites like MSDN?

    • @sunraiii
      @sunraiii 11 หลายเดือนก่อน

      ​@@merlinwarage Congrats on being a dick under a positive comment.
      Also, dev books are 80% fluff, 20% content and MSDN is for boomers.

  • @dragonspirit254
    @dragonspirit254 ปีที่แล้ว +1

    I would also add a blur filter to smooth out those low res jpeg artifacts.

  • @lukas.webdev
    @lukas.webdev ปีที่แล้ว +21

    I heard about it, but actually never used it ... But this actually seems pretty helpful. Keep it up. 😉🔥

    • @harris.sensorsoffline6419
      @harris.sensorsoffline6419 ปีที่แล้ว +2

      Whose gonna do it? so much typing of extra code 😁 so much work. Just basic lazy loading is enough.

    • @Peshyy
      @Peshyy ปีที่แล้ว +3

      @@harris.sensorsoffline6419 I see you don't care about UX at all

    • @harris.sensorsoffline6419
      @harris.sensorsoffline6419 ปีที่แล้ว

      @@Peshyy It won't be ideal, to work on a ldiotic Blur Image Lazy Load when native lazy load is faster & better.

    • @Peshyy
      @Peshyy ปีที่แล้ว +2

      ​@@harris.sensorsoffline6419 native lazy loading is still being used. the difference is that with one, you get images pop out of nowhere on slow networks; with the other - the images are placed where they should be, the user is visually aware there's an image there and how it should look like, and gets nice visual feedback that the image is being loaded.
      calling it "idiotic blur image lazy load" shows a lot about you

    • @harris.sensorsoffline6419
      @harris.sensorsoffline6419 ปีที่แล้ว

      @@Peshyy If you are working on a Gov Project that requires support for Slower Network & Older Browsers. You can't even support native lazy loading better luck with Tables to align those IMGs 😁.
      Just kiddin, like you can convert all your images to webp with extreme compression & native lazy loading. Enough, to work good on all 4G Connections that most World runs on.

  • @HuynhLuong227
    @HuynhLuong227 ปีที่แล้ว

    Thank you

  • @Buster475
    @Buster475 ปีที่แล้ว +5

    Considering that jpeg encodes in 8x8 blocks, maybe 16x16 or 24x24 pixels would work better?

  • @blikardo
    @blikardo 2 หลายเดือนก่อน

    Great video as usual. What do you think of the use of 'skeletons' while loading stuff. Is it any better than having to have multiples files of the same image but sized down?

  • @draftermyself
    @draftermyself ปีที่แล้ว

    Cool! 👍

  • @JordanICM
    @JordanICM 6 วันที่ผ่านมา

    At my job they really want us to improve the ligthouse scores. Have you done any tests to see what maximizes the lighthouse score (things like first/largest contentful paint)? I know you may even have to do strange stuff like not use external css files if your site has a really big one. I think it would be great if you could do a showcase of all the different ways to lazy load & optimize images and then show what kind of lighthouse scores they get (specifically on mobile, that's the killer). Thank you for this vid!

  • @faresanalissyahad4468
    @faresanalissyahad4468 ปีที่แล้ว

    love the content

  • @user-qd2sd4mx2k
    @user-qd2sd4mx2k ปีที่แล้ว

    good video thanks

  • @TehPwnerer
    @TehPwnerer ปีที่แล้ว +5

    In the 90s with JPEG they would load exactly like you describe and they can because the the way jpegs are constructed using frequency data so you can load lower frequency components first making up a blurry pixelated image like you have slowly transitioning into the actual image as finally received and loaded

    • @mohammadmahdimohaveri6580
      @mohammadmahdimohaveri6580 ปีที่แล้ว +7

      What you're describing is called Progressive JPEG, normal JPEG stores image block by block and cannot be rendered Progressively, but Progressive JPEG stores data from lower frequencies to higher ones, so it can load in an un-bluring manner

    • @alex_smallet
      @alex_smallet 10 หลายเดือนก่อน

      Yes, it's called jpeg 2000. Unlike regular jpeg, where they use Fourier transform, jpeg 2000 uses wavelet transform, which allows for better perceived image quality with smaller file size. Windows does not support it, but on a macOS you can save an image in jpeg 2000 format.

  • @Booyamakashi
    @Booyamakashi ปีที่แล้ว +4

    Thanks, ill just use progressive jpegs.

  • @canarymultimedia
    @canarymultimedia ปีที่แล้ว +17

    What happened to progressive jpg anyway? That was a really cool feature built into the image...

    • @tom3f
      @tom3f ปีที่แล้ว +5

      It should still works, and it is much simpler than this.

    • @lapridagaspar
      @lapridagaspar ปีที่แล้ว

      That would still start the resource download on page load even if the image is 200 viewport a down.

    • @mohammadmahdimohaveri6580
      @mohammadmahdimohaveri6580 ปีที่แล้ว +7

      You can lazy load progressive jpeg as well, and this way you're not wasting user's bandwidth for blurred images, image actually loads progressively and you won't have to manage two sets of assets

    • @GonzaloMassa
      @GonzaloMassa ปีที่แล้ว +1

      I was looking for this comment

  • @JoseRuiSantos-ruisoftware
    @JoseRuiSantos-ruisoftware ปีที่แล้ว +11

    If you already know the image dimensions before loading it, then you should add the width and height attributes to you img. This avoids the annoying effect of seeing the content moving around during image loading

    • @YuriG03042
      @YuriG03042 ปีที่แล้ว +8

      also known as CLS, which is Cumulative Layout Shift, which will impact the page SEO ranking

    • @thalisonamaral1642
      @thalisonamaral1642 ปีที่แล้ว +1

      @@YuriG03042 What do you mean ? using width and height impact SEO ranking negatively?

    • @JoseRuiSantos-ruisoftware
      @JoseRuiSantos-ruisoftware ปีที่แล้ว

      @@thalisonamaral1642 It is the other way around. Not using width/height affects the SEO ranking negatively and increases the cumulative layout shift score. Google for "cumulative layout shift"

    • @rproctor83
      @rproctor83 ปีที่แล้ว +2

      ​@@thalisonamaral1642 After 20 years fuckig around with Google bullshit I can tell you without a shadow of doubt that most all of these SEO tips are an utter waste of time and effort. If you ever look at some of the top ranking sites in highly saturated market you will see most of them are trash, a million console errors, dozens of tracking cookies, elements jumping around, interstitials and popups, bad semantics, too much advertising blocks, shallow content, meaningless content, duplicated content, I mean the list goes on.

    • @thekwoka4707
      @thekwoka4707 11 หลายเดือนก่อน +2

      @@rproctor83 no, it's just that being the thing people want is always most important.
      But layout shift is still annoying for users period.

  • @berkaybakacak
    @berkaybakacak ปีที่แล้ว

    You are a savior :D

  • @QwDragon
    @QwDragon ปีที่แล้ว

    1. You can set background on an img itself. But I think it'll be impossible to add pulse over it.
    2. Seems like progressive jpeg (especially with http2) could've solve the problem too?
    3. 08:48 I like this more than blurry until load.
    4. 10:30 It would be better to specify { once: true } so that it usubscribes after event occures.

  • @Jdinrbfidndifofkdndjoflfndjdk
    @Jdinrbfidndifofkdndjoflfndjdk 10 หลายเดือนก่อน

    Thank you next/image for not making having to write all of this :). Great video btw.

  • @avivperets7360
    @avivperets7360 หลายเดือนก่อน

    Thanks again man! can you made also one video about file types? webp and avif versus jpeg also svg can be nice

  • @Abdallah_Ismail
    @Abdallah_Ismail 11 หลายเดือนก่อน

    Thank god programming is like an open-book exam, you just need to know that it can be done and you will have Kyle here to help you do it

  • @user-kq7qg9db7g
    @user-kq7qg9db7g ปีที่แล้ว +2

    Web Dev is the best👍

  • @user-fed-yum
    @user-fed-yum 11 หลายเดือนก่อน

    So impressed with your skills, every single piece of content you produce. Just a heads up, that addEventListener will leak memory. Simplest fix would be to add an option argument with once:true.

    • @cookieman.19
      @cookieman.19 9 หลายเดือนก่อน

      Is that the third argument?

    • @user-fed-yum
      @user-fed-yum 9 หลายเดือนก่อน +1

      @@cookieman.19 Yes, add { once: true } for the third argument 👍

  • @jubinkashyap5027
    @jubinkashyap5027 8 หลายเดือนก่อน

    ❤❤❤thank you

  • @vuongqtvn
    @vuongqtvn ปีที่แล้ว

    😍 nice sir

  • @lapridagaspar
    @lapridagaspar ปีที่แล้ว +83

    Cool!
    I personally prefer not having extra markup. You can have the background image directly on the img tag. You wouldn't have the exact fade in animation you achieved but if you save your images with "progressive" turned on, they load in waves of less quality to more quality instead of top to bottom.
    Also, I think that hiding images by default isn't very progressively enhanced. You could instead add a class when JS starts running to hide them, or the classic remove the .no-js class on the body.
    Also, wouldn't it be more performant to do the pulse animation with opacity rather than changing the background color value? I think this can be done without extra markup as well (there's no need even for a pseudo element)

    • @lapridagaspar
      @lapridagaspar ปีที่แล้ว +19

      One more thing. In your example it doesn't really matter, but for regular block images (not on a grid like yours) lazy loading can cause layout shift.
      To prevent this, you should specify each image width and height attributes.
      What's more, if you have those values and you are dealing with responsive images, you could also set a style with --_img-width and --_img-height custom properties. This should be the pixel value without unit.
      Then, in your CSS
      img[loading="lazy"]{
      max-width:100%;
      height:auto;
      aspect-ratio: var(--_img-width) / var(--_img-height);
      }

    • @aniketpandey2524
      @aniketpandey2524 ปีที่แล้ว

      while trying this out i ran into said issues and after struggling for 20 minutes I arrived at almost the same solution you gave except for the progressive part. Have no idea what that means. Can you please explain?

    • @PhoenixXxXx91
      @PhoenixXxXx91 ปีที่แล้ว +14

      @@aniketpandey2524 Progressive images, supported since ages from jpg format include the small image Kyle generates inside the image itself. Also, the top-to-bottom loading is different on this kind of images - the same effect we're trying to have in the video, except that it is browser native, rather than using JS. I personally create the progressive images with the "export for web(legacy)" using the "progressive" option in Photoshop, but pretty sure you can find a free tool for that.

    • @aniketpandey2524
      @aniketpandey2524 ปีที่แล้ว +1

      @@PhoenixXxXx91 oh! Now I got it. I thought he's talking about some new option in img tag of html.. 😅

    • @lapridagaspar
      @lapridagaspar ปีที่แล้ว +10

      @@aniketpandey2524 JPGs can be saved as "progressive" from photoshop. I'm sure there are other ways, but that's how I do it.
      If you are going full on optimization you may also consider a tag with the image inside as a WEBP or any other modern web format; with the JPG fallback.
      I don't know if WEBP has this "progressive" option.

  • @juergenstenzel7300
    @juergenstenzel7300 11 หลายเดือนก่อน

    very nice 🙂

  • @arman369world
    @arman369world 11 หลายเดือนก่อน

    It was great and useful, thank you. How can I load the photos myself? For example, load photo number 3 first and then photo number 8?

  • @DaBigin
    @DaBigin ปีที่แล้ว

    This video is 🔥

  • @errorerror1337
    @errorerror1337 11 หลายเดือนก่อน

    Love this man, awesome video! Can you please do a vid on requestAnimationFrame()?

  • @dailydoseofchocolate9411
    @dailydoseofchocolate9411 5 หลายเดือนก่อน

    Please make a video about next image too? My problem is how to set height on dynamic images in next js without them losing the aspect ratio and keeping the responsiveness

  • @csisyadam
    @csisyadam ปีที่แล้ว +15

    1. Would ".blur-load:not(.loaded)::before" work?
    2. What do you think about "animation-direction: alternate"?
    3. Setting the bg color to white and play with the opacity in the animation is another way to do it.

    • @uwu-zl6tq
      @uwu-zl6tq 11 หลายเดือนก่อน

      ok

  • @imluctor5997
    @imluctor5997 ปีที่แล้ว

    question, does this have to do with downloading the image or rendering? Because wouldn’t it look better if it just shows an icon that its loading and then renders it instantly on the screen once it fetched it from the database (or wherever it came from)?

  • @phallo
    @phallo ปีที่แล้ว +43

    Sorry for the rant, but it's important to share this information because your solution has been used for years and has negatively impacted websites.
    To tackle this issue effectively, the best approach is to choose a background color that closely matches the upcoming image you're about to load. You can even consider using a gradient for a nicer visual effect. This helps eliminate the white background. Additionally, using progressive jpegs for larger images is recommended.
    By following this method, the image will load gradually from a blurry state to a sharp one, instead of loading from top to bottom all at once. As a result, the loading process will seem much faster, and the images will appear to load almost instantly, without any abrupt transition from blurry to sharp and without the unnecessary code.
    Please don't feel discouraged, as we're all continuously learning, and it can be challenging to find the best solution for every situation. There might even be a better solution out there that I'm not aware of. Lastly, I want to commend you on the great work you're doing, as your videos provide a lot of valuable information!

    • @ozoindaprince
      @ozoindaprince ปีที่แล้ว

      please can you make a visual on what you mean? English isn't my first language 👍

    • @winken2666
      @winken2666 ปีที่แล้ว

      How would you know the color of the img before you got the img

    • @Issvor
      @Issvor ปีที่แล้ว

      @@winken2666OP's response is clearly related to the video, which uses locally stored images, which have a small and large variant. Instead of having a small.jpg, you'd just use a background-color of whatever the large image looks like

    • @rossclutterbuck1060
      @rossclutterbuck1060 ปีที่แล้ว +1

      @@winken2666 eh? you would know the colour because they are your images

    • @derpysean1072
      @derpysean1072 ปีที่แล้ว

      Can you elaborate on how bad the impacts are on websites? I can't think of a problem with loading 20px img. The performance should be similar, yet the visual is much better than a solid block of color.

  • @mukhtarhussain8954
    @mukhtarhussain8954 ปีที่แล้ว

    amazing

  • @WadieGamer
    @WadieGamer ปีที่แล้ว

    Welcome back

  • @Chalisque
    @Chalisque ปีที่แล้ว

    What is the right way to ensure that the placeholder div is the same size the image will be, once loaded, to avoid jerky reflow issues.

  • @ZackPyle
    @ZackPyle ปีที่แล้ว +7

    You could also throw a filter blur on it to make that pixilated small file look a little nicer

    • @gowthammurugan6392
      @gowthammurugan6392 ปีที่แล้ว +1

      Actually, you are right, but when we use the 'Filter blur' effect on the mobile version, it feels laggy.

    • @ZackPyle
      @ZackPyle ปีที่แล้ว

      @@gowthammurugan6392 Interesting. Which part feels laggy?

  • @Trazynn
    @Trazynn ปีที่แล้ว +41

    Is it possible to lazy load in a sharp pixelated style. Because pixel-art aesthetic is really hip these days.

    • @spandanbarve1066
      @spandanbarve1066 ปีที่แล้ว +1

      Yes

    • @a1x5h04
      @a1x5h04 ปีที่แล้ว +1

      Yes you can

    • @sanzharsuleimenov379
      @sanzharsuleimenov379 ปีที่แล้ว +21

      Well done guys, one more happy comentator that got his question answered

    • @spandanbarve1066
      @spandanbarve1066 ปีที่แล้ว +1

      @@sanzharsuleimenov379 thank you

    • @ankanpoddar8815
      @ankanpoddar8815 ปีที่แล้ว +1

      You can create a smaller pixelated version of your image and use that as the bg of the div.

  • @1gabrielroman
    @1gabrielroman ปีที่แล้ว +3

    It is a sexy solution. But after I've tried it I found something a bit fancier with less boilerplate. Try to use Verlok's vanilla-lazyload (only 2kb) with on-the-fly generated svgs (you can put the loading animation inside the svg template). It ends up having a bit more bytes around (400b to 2kb depinding on resolution) but the fun thing is it only requests it once for each resolution. So in your example you can use a standard 500x500 svg and you would have 1 request for the loading and the placeholder.

  • @mrnabby4178
    @mrnabby4178 ปีที่แล้ว

    wow no library or framework. You are awesome man.

  • @sengarnikhil
    @sengarnikhil ปีที่แล้ว

    I am curious to know, if we set content to none. But left animation there. Will it take any computation load as animations are cpu intensive.
    Or browser intelligently will remove the animation property if no content is there

  • @goodluckoriuwa1669
    @goodluckoriuwa1669 8 หลายเดือนก่อน

    This is good to know.... But one more thing... Can you show how to implement this feature in react front end application???

  • @MerrickKing
    @MerrickKing ปีที่แล้ว

    Is this how you'd do this in React too? Or would you do it a different way?

  • @gwemula
    @gwemula ปีที่แล้ว

    Hey Kyle. The component in Next.js take care of this problem?

  • @asheryramtetteh-abotsi2157
    @asheryramtetteh-abotsi2157 8 หลายเดือนก่อน

    What if you are querying the images from a database, how would you implement the blur in case it takes time to load

  • @MrTomyCJ
    @MrTomyCJ ปีที่แล้ว +1

    I really don't see how blurry jpegs are nice looking, they are even quite horrible imo, but the idea and technique as a whole is for sure nice and useful.

  • @93kumite
    @93kumite ปีที่แล้ว

    Hey Kyle I've a question
    According to you, what are the fundamental concepts of Computer science a web developer ( let's say full stack developer) should know ?
    Thanks

  • @kantikuijk7239
    @kantikuijk7239 ปีที่แล้ว +4

    Is there a reason to use ffmpeg over imagemagick? I was under the impression that ffmpeg is tailored for videos, and imagemagick for pictures.

    • @black_platypus
      @black_platypus ปีที่แล้ว +1

      No, he says as much (something like "there are tons of ways, use what ever you want")
      I'm guessing he just had a good workflow set up for ffmpeg that he was familiar with, so he threw the images at it because he could :P