DON'T Serve Unoptimized Images - Webp, Srcset, ImageKit, and more!

Sdílet
Vložit
  • čas přidán 7. 07. 2021
  • Unoptimized images leads to a bad user experience. Don't make the mistake of serving massive images which leads to longer load times and frustrated users and customers.
    In this video, we'll cover a few ways to optimize your images for the web. You can start by using something like tinypng.com/ to compress your images. Then, you can take it to the next level with ImageKit.
    ImageKit can dynamically create multiple different sizes of your images. When you combine this with the srcset propert in HTML, you can always serve the correct size depending on the user's screen size and pixel density. It can also determine the optimal image format to send to the user based on the browser.
    ImageKit docs : docs.imagekit.io/features/ima...
    ImageKit blogs on resizing: imagekit.io/blog/tag/image-re...
    Srcset with Kevin Powell - • srcset and sizes attri...
    _____________________________________________
    Newsletter 🗞
    Interested in exclusive content and discounts? 🤯 Sign up for the newsletter!
    www.jamesqquick.com
    _____________________________________________
    Connect with me 😀
    Live streams on Twitch - / jamesqquick
    Follow me on Twitter - / jamesqquick
    Join the 💬 Discord Server 💬 - / discord
    _____________________________________________
    COURSES 💻
    Learn how to build Fullstack apps with React and Serverless Functions - www.jamesqquick.com/courses/r...
    Learn everything you need to know about Visual Studio Code - www.udemy.com/learn-visual-st...
    Build a Quiz App - www.udemy.com/build-a-quiz-ap...

Komentáře • 64

  • @nyarehd
    @nyarehd Před 2 lety +12

    Thanks for sharing.
    I've just finished my portfolio site and yes, images takes about 40% of loading time.
    This gonna be useful.

  • @1ku0k
    @1ku0k Před rokem +2

    You are the only image kit tutorial video on youtube... You should have a lot more hits!

  • @Allformyequine
    @Allformyequine Před rokem

    Such great AWESOMENESS! How did I miss this one! Great stuff thank you as usual!!

  • @Sankaritarina89
    @Sankaritarina89 Před 2 lety +2

    Good video. I've been doing all these optimizations just recently to improve our LCP score. The only thing missing is webp. We have our own asset server so I'm going to have to dive deep to see what needs to be changed...
    I was just wondering, if I had like 100 JPGs, and I wanted to serve them as webp, I'd have to convert the whole batch beforehand right? Converting on the fly might not create any benefits no?... Just wondering...

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

    I love this tutorial... simple, usefull and beautiful. Thank you for sharing.

  • @MaxProgramming
    @MaxProgramming Před 2 lety

    THAT IS VEEEERY INTERESTING! Thanks James 🚀🚀🚀

  • @luuduytoan3819
    @luuduytoan3819 Před 2 lety

    Thank you so much for this tip!!

  • @theog4983
    @theog4983 Před 2 lety

    Hi James. I'm curious about one thing; can you please explain why you decided to create an array with the numbers 1-10 and using Foreach, as opposed to using a for loop which wouldn't necessitate creating an array for indexes?

    • @JamesQQuick
      @JamesQQuick  Před 2 lety

      Great points. Unfortunately this was just an oversight. As I changed the way demo I did the demo, I forgot to update some parts of the code. Sorry for the confusion!

  • @briandwayne3869
    @briandwayne3869 Před rokem

    Very well done. I needed to know this like right now! 🤣

  • @mati2370
    @mati2370 Před 2 lety

    What to do in case a cloud service stops responding for some reason? Can we set a fallback local image to show up instead of an alt attribute text?

  • @timbittins
    @timbittins Před 2 lety

    If you don't have much time, make it Quick. Cause this guy got you covered.

  • @harratabdelmalek2062
    @harratabdelmalek2062 Před 3 měsíci

    Thank you so much , man ❤

  • @luonglinhkhoi401
    @luonglinhkhoi401 Před 2 lety

    I wonder if imagekit support adding metadata such as title or description when requesting and getting response

  • @strikeralph
    @strikeralph Před 6 měsíci

    Helped so much❤

  • @thetawise
    @thetawise Před rokem

    This is awesome! thanks for sharing :)

    • @JamesQQuick
      @JamesQQuick  Před rokem +1

      Glad you enjoyed it!

    • @thetawise
      @thetawise Před rokem

      @@JamesQQuick Are there any optimizations we can make around serving gifs via imagekit? Currently it seems like cloudfront caching (media served through static s3 bucket via aws) is more performant than imagekit for Gifs, but I'm unsure if this is because I haven't configured imagekit correctly to serve Gifs

  • @destinlee
    @destinlee Před 2 lety

    Fun watching this now that you told us how it was all done on the last Compressed 🍻

  • @varshasingh1299
    @varshasingh1299 Před 2 lety

    First like comment then see complete video...that much I trust you...

  • @SmashieHC
    @SmashieHC Před 2 lety

    I would love something like this for next/image since I'm currently using that and deployed a Netflix-Clone, but i'm having a hard time optimizing the images. And if I use next/image all of my styling breaks...

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

    That's what I need. Thanks.

  • @mrBurlaka1
    @mrBurlaka1 Před 3 měsíci

    so cool! thanks

  • @RubberDuckCoding
    @RubberDuckCoding Před 2 lety

    VERY VERY NICE!

  • @arlecchino783
    @arlecchino783 Před 2 lety

    What was the vscode theme name you used?

  • @lucasmendonca2197
    @lucasmendonca2197 Před 2 lety +2

    These thumbnails with ❌ and ✔️ are great attention-grabbers! keep 'em coming please

    • @JamesQQuick
      @JamesQQuick  Před 2 lety

      Thanks! They definitely seem to get more visibility

  • @itgiants5218
    @itgiants5218 Před 2 lety

    what is the vscode theme you're using?

  • @patricknelson
    @patricknelson Před 6 měsíci

    BlurHash is also another good method for showing blurry placeholder images while waiting for the larger images to load.

  • @kirayamato6128
    @kirayamato6128 Před 2 lety

    Is it not loosing the quality of image when you compressed it?

  • @whatthefunction9140
    @whatthefunction9140 Před 2 lety

    This is gold

  • @renatoloefstop
    @renatoloefstop Před rokem

    Nice tutorial! What if the requirement was that people need to upload images on let's say a contact form and you need to compress/optimize those before the user uploading them?

    • @JamesQQuick
      @JamesQQuick  Před rokem

      You could do a check on the file size of the image they are looking to upload and show an error message if it's too big. Is that what you mean?

    • @renatoloefstop
      @renatoloefstop Před rokem

      @@JamesQQuick Thanks for the reply! In stead of the error msg, it would be nice to automattically reduce images that are beyond certain file size (let say >2MB) so to minimize bad user experience by showing just the error. I find people using contact forms with file upload fields on their cell phones don't necessary know how to reduce them if they encounter an error while uploading. Are there good JS library's for this, how to use them or what do you recommended?

    • @hetoverseo3887
      @hetoverseo3887 Před rokem

      @@renatoloefstop Search about sharp js, cdns and optimizing user input media.

  • @bonganintshangase6051

    Could you please walk us through uploading on imagekit via client, react to be specific.

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

    And what about when you have API, with images, where that was loaded/apply be users, and u aas frontend web dev should make this images smalled? Have you any idea ? You dont want every image translate by hand.

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

    Now I'm curious on how image kit protects itself from denial of service attacks or prevents people from causing crazy costs to a company by abusing the dynamic imagine generation 🤔

    • @thedeadz0ne1
      @thedeadz0ne1 Před 2 lety

      You can restrict requests via "named-transformations" meaning you create pre-made transformations and name them, then, if you choose, imagekit can deny any transformation that isn't named. I believe there is throttling as well, plus if you call the same transform over and over it's cached

  • @SunilSkanda
    @SunilSkanda Před 2 lety

    Thanks 👍

  • @zergzerg4844
    @zergzerg4844 Před 8 měsíci

    Why srcset doesn't work. I don't se the changes, but if i 'm making changes in src by addin tr attribute it works fine

  • @datoshcode
    @datoshcode Před 2 lety

    Compare a compressed file in the png format and in webp format.

  • @RianY2K
    @RianY2K Před 2 lety

    thank you for tutorial. Maybe you can use Webpack to compress assets image during building production.

    • @JamesQQuick
      @JamesQQuick  Před 2 lety

      That’s a good idea too!

    • @gimp3695
      @gimp3695 Před 2 lety

      You can do this. I've used a webp loader, however dynamic content that users upload obviously doesn't run through webpack. This is a great option for doing that outside

  • @diegognoatto590
    @diegognoatto590 Před 2 lety

    pretty neat

  • @pixelmasque
    @pixelmasque Před 2 lety

    great!

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

    #AVIF to rule them all 💪

  • @riju22
    @riju22 Před 2 lety

    I always use the picture tag with webp and fallback, while using imagekit as cdn

  • @ha_ks799
    @ha_ks799 Před 2 lety

    I recommend compress.js

  • @rimantasdanilevicius6754

    what about video optimization?

    • @JamesQQuick
      @JamesQQuick  Před 2 lety

      That’s something I don’t know as much about. I assume similar principles apply though

  • @nifares8744
    @nifares8744 Před 2 lety

    9:22 hoy vi ese video.

  • @encycl07pedia-
    @encycl07pedia- Před 8 měsíci

    You're missing a really huge way to optimize your site with those images: you don't even need 80% of the ones you showcased. Most of it is text on a background. Just put the text as actual text. and put the profile picture circles as the only pictures on the page. It looks like some of them were reused so you'd only need to load 1 or 2 much smaller images instead of 6 huge, mostly-redundant images.
    Text shouldn't be in images unless it's a logo or wordmark.
    Also your contrast is pretty awful with the black leading 00 on top of a black background. Vincent Flanders of WPTS would have a field day with those images on a website.
    WebPs are also just bad for the end user if they want to save them. Lazy loading is the same. It doesn't work if JS is turned off or not supported. Those substitutions and calculations also cost computing power.
    For thousands of years (decades, but that's not as fun to say), man has used thumbnails with real image formats. It worked on dial-up. It works today. Just optimize the image by making thumbnails. It's simpler, faster, cheaper, and just works.

  • @chhavimanichoubey9437
    @chhavimanichoubey9437 Před 2 lety

    dynamic imagekit.io

  • @kennedya7848
    @kennedya7848 Před 2 lety

    im interested in this. but i dont like to put 18 minutes of my life to watch this.

    • @JamesQQuick
      @JamesQQuick  Před 2 lety

      Hmmm how much time can you give?

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

      if you can, atleast 10mins max. but if it cant really be compressed in a short video, make sure what you say is not repeated. i noticed your intro is almost 2 mins long. at most 30 secs will do. and what you said there was once again repeated later in the vid, wastes time.
      also, make use of sections/timestamps. just a simple big title on screen on what part you are taking about.
      but hey, im just a random internet dude in your comment section. it's your choice if you want to follow my opinions/recommendations.
      i'll be wishing you luck on your youtube career.

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

      I watched this in 1.5X speed and was able to follow along just fine.

    • @patricknelson
      @patricknelson Před 6 měsíci

      @@JamesQQuickShould have used ImageKit to compress your video! (j/k)