How to speed up image loading on website - PKONEJOB:: Pakistan Jobs 2023

Monday, March 7, 2022

How to speed up image loading on website

 How to Speed up Image Loading on Website

The second key way to improve page load speed is compression.

Have you ever tried to send a file over email that was too big and you had to compress it into a ZIP file to make it small enough to send? Well, that’s compression at work. When a user arrives on your website, a request is made to your server, which is the computer program that stores, processes, and delivers web pages. This happens for every single file. The larger these files are, the longer it takes to load.

How to speed up image loading on website
How to speed up image loading on website

What is compression?

Compression replaces repetitive pieces of code with markers directing to the first instance of that code. Compression’s purpose is to reduce the file size during transfer from the server to browser. Once the file arrives, the browser has to decompress it, like when you download a zipped folder onto your computer and can’t just open it. You have to unzip it first. The same thing happens when the browser receives compressed files, but it’s automatically handled by the browser.

Compression vs. Minification Minification

• Removes whitespace, comments, and non-required semicolons.

Compression

• Removes all strings that are repeated.

How do you get started with compression?

There are a couple solutions out there for compression: Gzip and Brotli. Gzip and Brotli are both open source free to use. Enabling compression can get pretty

technical and it will depend on the server that you’re using. Many other CMSs on the marketplace will also compress your files. If you’re using the, your files will be compressed automatically. No work needed. But you can enable compression on other servers. For those of you who are self-hosting your website, this is where you’re going to want to work with your web expert.

How can you enable compression?

Compression is enabled by adding code to a file called  htaccess on the web server.

.htaccess files can be used to alter the configuration of your server to enable or disable additional functionality and features, including compression. To learn what code needs to be added to your .htaccess file, check out the guide. This walks you through what code needs to be added for a variety of servers.

Minification and compression are two solutions to reduce your page size.

They perform their best when they work together. By removing extraneous code and marking duplicate strings, your web page will have smaller file sizes which means a faster load speed.

 

No comments:

Post a Comment