This API endpoint was made by Automation Tribe.
Join our community at https://www.skool.com/automation-tribe.
This API resizes and optimizes images provided via URL or direct upload. Input is via form-data (multipart/form-data).
Logging: On errors, a log file (e.g., image_resize_timestamp.log
) will be created in the 'logs' subfolder of temp_image_files
.
https://n8achraf.com/image-resizer.php
POST
multipart/form-data
image_file
(Optional if image_url
provided): The image file to upload.image_url
(Optional if image_file
provided): URL of the image to process.width
(Optional): Desired width in pixels. Aspect ratio maintained if only width is set.height
(Optional): Desired height in pixels. Aspect ratio maintained if only height is set. (If both width and height are set, image is resized to those exact dimensions, potentially altering aspect ratio).quality
(Optional): Output quality (0-100). Default: 85 for JPEG/WebP. (For PNG, this controls compression level).format
(Optional): Desired output format (jpeg
, png
, webp
). Default: jpeg
.output_filename
(Optional): Desired base name for the output file (e.g., "my_custom_image"). Extension will be added based on 'format'. Default: "processed_image_timestamp_random".You must provide either image_file
or image_url
.
On success, the API returns the processed image directly with the appropriate Content-Type
header (e.g., image/jpeg
) and a Content-Disposition: inline; filename="your_filename.jpg"
header. You can display this image directly or save it.
{
"error": "Descriptive error message."
}
Using image_url with custom filename:
curl -X POST 'https://n8achraf.com/image-resizer.php' \ -F "image_url=https://www.php.net/images/logos/new-php-logo.png" \ -F "width=300" \ -F "format=jpeg" \ -F "quality=80" \ -F "output_filename=php_logo_resized" \ -o php_logo_resized.jpg
Uploading a local file (replace path/to/your/image.png
):
curl -X POST 'https://n8achraf.com/image-resizer.php' \ -F "image_file=@path/to/your/image.png" \ -F "height=200" \ -F "format=webp" \ -F "output_filename=my_uploaded_image" \ -o my_uploaded_image.webp