DEV Community

Cover image for Convert jpg, png to WebP WordPress Plugin
Luc_C
Luc_C

Posted on • Edited on • Originally published at blog.accolades.dev

Convert jpg, png to WebP WordPress Plugin

originally written on my blog.

As a WordPress developer and programmer, I’ve had the pleasure (or the horror ^_^ ) of navigating the intricate world of website performance optimization.
In my journey, one challenge I consistently find is optimizing images for faster load times without compromising on quality.
Some months ago I created a tool that I uploaded on GitHub and you can convert PNG and JPG to WebP. (read more here)
Today, I’m thrilled to share a comprehensive solution I’ve developed – a lightweight WordPress plugin designed to convert JPG and PNG images to WebP format: “Convert JPG, PNG to WebP.“

Convert JPG, PNG to WebP Plugin

Do you want to know about the PRO version?
CLICK HERE

What It Does: A Focus on Efficiency and Quality
In the digital age, website speed is not just a luxury; it’s a necessity. Images, while important for engaging content, often pose a significant bottleneck in loading times due to their size.
WebP is Google’s modern image format that provides superior lossless and lossy compression for images on the web. By converting traditional formats like JPG and PNG to WebP, my plugin offers a straightforward solution to this dilemma.

Unlike other image optimization tools that create multiple versions of the same image to adapt to different screen sizes, “Convert JPG, PNG to WebP” focuses solely on converting images to the WebP format. This approach streamlines the optimization process, ensuring that your website benefits from reduced image file sizes without the added complexity of managing multiple image versions. The result? Faster loading times, improved SEO rankings, and a better user experience.

Designed to Be Lightweight

I understand the concerns many WordPress site owners have regarding plugin bloat. Too many plugins or overly complex ones can slow down your site, create security vulnerabilities, or cause compatibility issues. That’s why I designed Convert JPG, PNG to WebP to be as lightweight as possible.

This plugin doesn’t clutter your dashboard with unnecessary features or settings. Instead, it integrates seamlessly into your WordPress site, working quietly in the background. Once activated, it automatically converts JPG and PNG images to WebP format during the upload process. For WordPress administrators, a simple settings page allows for easy control over the plugin’s functionality without overwhelming you with options.

Security and Best Practices

In developing “Convert JPG, PNG to WebP,” I prioritized security and adherence to WordPress best practices. The plugin ensures that all variables and options are properly escaped when echoed, preventing cross-site scripting (XSS) vulnerabilities. Additionally, it prevents direct file access to plugin files, further enhancing the security of your WordPress site.

Furthermore, I’ve made sure the plugin declares a GPL-compatible license, ensuring it aligns with WordPress’s philosophy and allowing for community contributions and modifications. The plugin is also tested up to the latest WordPress version, ensuring compatibility and reliability.

Visual Feedback and Accessibility

Recognizing the importance of user feedback, the plugin provides clear visual cues for its operational status within the WordPress dashboard. When WebP conversion is enabled, the status message is displayed in bold green text; when disabled, it appears in bold red. This simple yet effective visual feedback ensures that administrators can quickly ascertain the plugin’s status at a glance, enhancing usability and accessibility.

How to use

To use the “Convert JPG, PNG to WebP Premium” plugin, follow these steps:

Installation and Activation:

Upload the plugin files to the /wp-content/plugins/ directory.
Activate the plugin through the ‘Plugins’ menu in WordPress.

  • Admin Interface:
    Navigate to the plugin’s admin page by going to the WordPress dashboard and finding the “Convert to WebP” menu item.

  • Settings Configuration:
    On the settings page, you can enable WebP conversion and configure whether to delete the original images after conversion.
    Save your settings.

  • Bulk Conversion:(Premium Only)
    Go to the bulk convert page through the “Convert to WebP” menu.
    You’ll see a list of images from your Media Library with checkboxes. Select the images you want to convert.
    Use the “Select All” checkbox to select all images at once if needed.
    Click the “Convert Selected Images” button to start the conversion process.

  • Upload Conversion:
    When you upload new JPG or PNG images to the Media Library, they will be automatically converted to WebP format if the conversion setting is enabled.

Example Usage

  • Install the Plugin:
    Upload the plugin files to the /wp-content/plugins/ directory.
    Activate the plugin through the ‘Plugins’ menu in WordPress.

  • Navigate to Plugin Settings:
    In your WordPress dashboard, find the “Convert to WebP” menu item and click on it.
    Go to the “Settings” submenu to configure your conversion settings.
    Enable Conversion:
    On the settings page, enable the “WebP Conversion” option.
    Optionally, enable “Delete Original Images After Conversion” if you want to remove the original images post-conversion.
    Save your settings.

  • Bulk Convert Existing Images(Premium Only):
    Go to the “Bulk Convert Images to WebP” page from the plugin menu.
    Select the images you want to convert by checking each image.
    Click the “Convert Selected Images” button to start converting the selected images to WebP format.

  • Upload New Images:
    When you upload new images to the Media Library, they will be automatically converted to WebP format if the conversion setting is enabled.

  • Verify Conversion:
    After conversion, verify that your images have been converted to WebP format by checking the file format of the images in the Media Library. However, if the conversion is successful, a console message will be confirmed.

Wrapping up.

As the web continues to evolve, so too do the strategies for optimizing its content. “Convert JPG, PNG to WebP” represents a focused approach to image optimization, cutting through the noise to offer a solution that’s both effective and efficient. By converting images to the WebP format, this plugin helps WordPress site owners improve their loading times, SEO rankings, and overall user experience without adding complexity or bloat to their sites.

I never imagined I would develop such a tool before 2020 as I started late my career. Today, I’m proud to offer the WordPress community a plugin that not only meets a critical need but does so in a way that respects the principles of simplicity, security, and performance. Whether you’re a blogger, an e-commerce site owner, or managing any other type of WordPress site, “Convert JPG, PNG to WebP” is designed to help your site reach its full potential.

Stay tuned for future updates as I continue to refine and enhance the plugin based on community feedback and the ever-changing landscape of web performance optimization and.

Do you want to support my work for as little as 10€?

Yes, I want to support your work.

Let's connect: 𝕏 , LinkedIn

Top comments (0)