ImageResizerX is an image resizing and management application developed in Golang. It simplifies the process of resizing images and saving them. The application's design follows the repository pattern for file storage. This means that if you need to change where the resized images are saved (e.g., from the local hard disk to cloud storage or a database), you can do so with relative ease by implementing an alternative repository, currently it is designed to save resized image files on the local hard disk. This project aims to provide a versatile image processing solution for various applications, all while being efficient and performant.
ImageResizerX offers the following key features:
-
Image Upload: Users can upload images via the
/api/v1/upload
endpoint. The application automatically resizes the image and saves it to the database, freeing users from the burden of manual resizing. -
Image Download: Resized images can be easily downloaded using the
/api/v1/download/<filename>
endpoint. Users can access their resized images whenever needed. -
Real-Time Updates: ImageResizerX uses WebSocket (WS) to broadcast messages when an image has been resized. Clients can connect to the WebSocket server at
/ws/
to receive real-time updates with download links for resized images. -
User-Friendly-Simple Interface: The project provides a static home page accessible via
/
. This interface allows users to upload images and connect to the WebSocket for real-time image resizing updates.
-
/api/v1/upload
: POST endpoint for image upload. It does not wait for the resized image and immediately returns a response. -
/api/v1/download/<filename>
: GET endpoint to download resized images by providing their uniqueimage_id
. -
/ws/
: WebSocket endpoint for real-time updates. It broadcasts messages about the resized images, providing download links. -
/
: The static home page where users can upload images and connect to the WebSocket for real-time image resizing updates.
Before running ImageResizerX, make sure you have the following prerequisites:
- Golang installed on your system
- Docker and Docker Compose (optional for Docker support)
-
Clone this repository to your local machine:
git clone git@github.com:guiflemes/ImageResizerX.git
-
Install project dependencies:
# Navigate to the project directory cd imageResizerX # Install Golang dependencies go get -d ./...
-
Build and run the application:
# Build the project go build # Run the application ./imageResizerX
The application will be available at
http://localhost:8080
. -
Access the home page (
/
) to upload images and connect to the WebSocket for real-time updates. -
Use the
/api/v1/upload
endpoint to upload images and the/api/v1/download/<filename>
endpoint to download resized images by providing their uniqueimage_id
.
ImageResizerX can also be run within a Docker container. To do this, make sure you have Docker and Docker Compose installed, and then run:
docker-compose up
The application will be accessible at http://localhost:8080
just like the local installation.