The idea for this plugin emerged when I began uploading featured images for the blog posts on this website. At first, the posts didn’t have featured images, but I later realized it was a good way to make them more visually appealing and improve the overall design. Featured images helped each post develop a clearer visual identity and added a more professional touch to the blog.
Since the posts were mainly text-based—especially in the upper section (above the fold)—the loading speed was already quite high. I didn’t want to compromise that performance by adding visual elements, so I decided to work with images in WebP format. To achieve this, I began converting each file manually using online tools. Although the process wasn’t particularly slow, it did become repetitive and tedious when I needed to upload several images or update content frequently. It also disrupted my workflow because it required leaving the editor, performing the conversion elsewhere, and then returning to WordPress.
As the blog grew, so did the number of featured images I needed to prepare, and it became clear that continuing with manual conversions wasn’t a sustainable long-term solution.
Since I was already familiar with Imagick and its use with PHP, the idea of creating a custom plugin naturally came up—one that could leverage this extension to handle the conversion at some point during the upload process. Although there are plugins that automate this task, I didn’t want to depend on external services or install third-party plugins that included unnecessary features or that might stop receiving updates.
With this in mind, I developed a solution that integrates directly with WordPress’s native upload workflow. The plugin converts JPG or PNG images to WebP before WordPress moves them to their final location, usually in the system’s temporary directory (/tmp). This also happens before generating different image sizes or registering the attachment in the media library, ensuring that the entire process uses the optimized image from the very beginning.
It’s worth noting that this solution currently works only with Imagick, as I considered the resource limitations of my current hosting environment.
The result is a lightweight, efficient plugin fully tailored to my needs. Thanks to this implementation, I maintain excellent loading speeds on my posts while enjoying a smoother workflow without relying on external tools. This solution has become an important part of my publishing process and a step forward toward a more optimized and easier-to-maintain website.