If you've ever needed to resize an image for a website, fast compression or even convert a PNG to JPG, you know how limited ready-made solutions can be - or how full of advertising and restrictions. As a developer and content creator, I decided to build my own own image resizing APIwith support for compression, format conversion and live preview - all within my WordPress environment.
In this article, I show you behind the scenes of this creation and how you can use or adapt something similar in your project.
API link: Online Image Resizer
Why did I create this API?
I needed a lightweight, functional and customizable solution for my own use and also for Criadix readers. Online tools don't always guarantee quality control, nor do they allow automated integrations with other workflows. By creating my own API:
- I won total control over resizing
- I was able to apply customized compression
- I made it possible for conversion between formats (PNG ↔ JPG)
- Added real-time visualization with on the front-end
- And I was able to offer all this via WordPress plugin
How does the API work?
The core logic is in a PHP file that acts as a REST endpoint. It allows:
1. Uploading multiple images
With type validation (jpg, jpeg, png, webp, gif, bmp or tiff) and size limit.
2. Reading the original dimensions
The API obtains the width and height of each image uploaded and displays it to the user in the preview panel.
Practical Tips for Getting Organized Efficiently
3. Resizing by pixel or percentage
The user can choose between setting manual dimensions or maintaining the proportion automatically.
4. Adjustable compression
Using Imagick, I control the quality of the final image.
5. Format conversion
If the user sends PNG and opts for JPG output, the conversion is applied with transparent background smoothing.
6. Download in ZIP
If more than one image is imported, all the processed images are compressed into a single .zip for immediate download. Otherwise, the same image name will be compressed.
User experience (UX) on the front-end
As I value both the technical side and the user experience, the front-end delivers:
- Live visualization with canvas
- Simple and clean interface
- Modal for enlarged view
Loading feedback and success with fetch and wp_ajax
How I implemented it in WordPress
Custom plugin
I've created a WordPress plugin called Image Process API. It registers an endpoint /wp-json/image-api/v1/process and offers it:
- Security with nonce
- Multiple file support
- Option to use GD or Imagick depending on the server
Directory structure
- /temp_uploads/ → received images
- /final_images/ → converted and compressed images
- /downloads/ → ready-made zip files
It also includes error logs for debugging and checking permissions on the local or remote server.
Next steps
Like any living project, I still want it:
- Add batch resizing via remote URL
- Create a dashboard to view usage statistics
- Offer a widget for easy integration into other sites
Creating my own image resizing API was more than a technical challenge - it was a practical, customized solution for my day-to-day life as a creator and developer. And the best thing: I can now offer this tool in Criadix to help other users who also need to optimize images with more freedom and quality.
If you want to learn more about WordPress and PHP development, this type of project is a great starting point - and totally applicable to real life.

