Issue #17 – Image Optimisation
Issue #17 – Image Optimisation
<1/> The Weekly Dev
When working with the web, images play an important role in user experience, images are used to communicate branding. It is thus important that these images are of good quality and appear as intended for the user without affecting user experience, however, good quality images might also mean bigger sized images and ultimately slowing your application, either by taking long to load, or affecting the layout of the application. In the pursuit of optimisation we are guided by Google’s Web Core Vitals, the metrics to consider being loading, interactivity, and visual stability.
Easy enough, because we can use the humble <img> element, if we play around enough with it, we can achieve good scores. You pass the alt attribute for accessibility, the width and height for browsers to know how much space to reserve for the image, this way we avoid layout shifts. We can use sizes and srcset attributes to achieve responsiveness, there is still more to do in order to achieve good user experience and adhere to Web Core Vitals guidelines.
The Next.js Image component, next/image, is an extension of the HTML <img> element, evolved for the modern web. It includes a variety of built-in performance optimizations to help you achieve good Core Web Vitals.
The NextJS Image component next/image has become the hero for image optimisation for a while, it gives developers more time to worry about the core function of an application and not worry much about images, you do not need to worry about the size the image comes in as because it will correctly optimize for the size of the image. Faster image loads, because images are only loaded when they enter the viewport. You do not need to worry much about working with the <img/> API, if the case is that you want more control and want to be closer to the <img/> element, you can use the next/future/image component which is now no longer in beta. In fact, there are plans to change the current next/image component to next/legacy/image in the future, so it would not hurt to start playing around with it. The alt property is also required for better accessibility. In order to successfully migrate to next/future/image from next/image here is how to go about it.
<2/> Deeper Dives
<3/> Inside the Console
AWS Cloud Map helps monitor your resources’ health, through automated health checks. When working with microservices using dynamic resources, some of these resources can be created and destroyed, their dependencies thus need to know their locations or state, as you update your resource and change their locations, Cloud Map helps resources discover the the latest location of the resources that they depend on.
Check-out the list of features and pricing for AWS Cloud Map.
<4/> Geeking It Up
A PostgresQL server that runs inside a browser. Supabase has collaborated with Snaplet, to bring us a way to persist data in the browser.
A hands on and interactive way to learn Typescript. Learn some nuggests that could make you a Typescript Wizard.
Make a video
A state-of-the-art AI system generates high-quality videos from text prompts
Dracula UI is a dark-first collection of UI patterns and components.