All image formats such as JPG, PNG, SVG are very commonly used on websites for a number of reasons such as links to Social Media accounts or icons to advertise or bring attention to your serivices. Images and icons take up room in the database and memory used to load them on to page. If you are using a lot of icons on your site, this can have an impact on your websites performance, as loading them will take time. In order to save some memory and time, you can try encoding small image files to Base64 format, which can convert any image file into a readable string which can be saved and transported over the network without data loss. The amount of characters requred to render even the smallest, most basic icons will be quite a bit more than you think so it’s best reserved small icons that only contain one or two colors.
I have include a couple of code snippet examples of functions I have made to be able to display an envelope, a telephone and an office icon by using a shortcode. The actual logic is the same for There are sites online that let you encode JPG, PNG or other common formats to Bas64 wihin a matter of seconds.
Building Icon
A shortcode is used to display a black building icon which can be used as an icon for contact information
Read morePhone Icon
A shortcode is used to display a black telephone icon which can be used as an icon for contact informtion
Read moreEnvelope Icon
A shortcode is used to display a black envelope icon which can be used as an icon for contact information
Read more