Image Resizer API Documentation
Our Image Resizer API allows developers to integrate image resizing functionality directly into their applications. The API provides a simple, RESTful interface for resizing, compressing, and converting images programmatically.
API Endpoints
1. Resize Image
Endpoint: POST /api/v1/resize
Description: Resize an image with specified parameters.
Parameter | Type | Required | Description |
---|---|---|---|
image | File | Yes | The image file to resize |
width | Integer | No | Desired width in pixels (maintains aspect ratio if height not provided) |
height | Integer | No | Desired height in pixels (maintains aspect ratio if width not provided) |
format | String | No | Output format (jpeg, png, webp, gif; defaults to original format) |
quality | Integer | No | Quality setting (1-100; defaults to 80) |
Example Request
curl -X POST \
https://fungame4u.site/api/v1/resize \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'image=@/path/to/image.jpg' \
-F 'width=800' \
-F 'format=webp' \
-F 'quality=75'
Example Response
{
"success": true,
"result": {
"url": "https://fungame4u.site/results/abc123.webp",
"download_url": "https://fungame4u.site/download/abc123.webp",
"width": 800,
"height": 600,
"format": "webp",
"size": 125432,
"original_size": 524288
},
"processing_time": 0.45
}
2. Get API Status
Endpoint: GET /api/v1/status
Description: Check API status and current usage statistics.
Example Request
curl -X GET \
https://fungame4u.site/api/v1/status \
-H 'Authorization: Bearer YOUR_API_KEY'
Example Response
{
"status": "operational",
"version": "1.0.0",
"uptime": 99.92,
"requests_this_month": 1243,
"remaining_quota": 8757,
"reset_date": "2023-07-01T00:00:00Z"
}
Authentication
All API requests require authentication using an API key. You can obtain your API key from the contact page.
Include your API key in the Authorization
header:
Authorization: Bearer YOUR_API_KEY
Rate Limits
The API has the following rate limits:
- Free tier: 10,000 requests per month
- Rate limit: 60 requests per minute
If you need higher limits, please contact us for enterprise plans.
Error Handling
The API returns standard HTTP status codes along with JSON error responses:
Code | Status | Description |
---|---|---|
400 | Bad Request | Invalid parameters or malformed request |
401 | Unauthorized | Missing or invalid API key |
403 | Forbidden | Rate limit exceeded or quota reached |
422 | Unprocessable Entity | Invalid image file or unsupported format |
500 | Internal Server Error | Server-side processing error |
Example Error Response
{
"success": false,
"error": {
"code": 401,
"message": "API key is missing or invalid",
"details": "Please include a valid API key in the Authorization header"
}
}
Client Libraries
We provide official client libraries for popular programming languages:
JavaScript
npm install image-resizer-api
Python
pip install image-resizer-api
PHP
composer require fungame4u/image-resizer
For more information or to request additional client libraries, please contact us.