{"id":15095853,"url":"https://github.com/zahidhasann88/go-image-processing","last_synced_at":"2025-03-27T13:26:35.808Z","repository":{"id":248583614,"uuid":"829085485","full_name":"zahidhasann88/go-image-processing","owner":"zahidhasann88","description":"This is provides a set of image processing functions with a RESTful API interface.","archived":false,"fork":false,"pushed_at":"2024-07-15T19:33:59.000Z","size":7494,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T17:44:17.883Z","etag":null,"topics":["gin","golang","image-processing","rate-limiter"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zahidhasann88.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-15T18:15:51.000Z","updated_at":"2024-09-15T17:11:19.000Z","dependencies_parsed_at":"2024-07-15T23:24:02.637Z","dependency_job_id":null,"html_url":"https://github.com/zahidhasann88/go-image-processing","commit_stats":null,"previous_names":["zahidhasann88/go-image-processing-ibrary"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidhasann88%2Fgo-image-processing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidhasann88%2Fgo-image-processing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidhasann88%2Fgo-image-processing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidhasann88%2Fgo-image-processing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zahidhasann88","download_url":"https://codeload.github.com/zahidhasann88/go-image-processing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245852588,"owners_count":20683063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gin","golang","image-processing","rate-limiter"],"created_at":"2024-09-25T15:42:43.292Z","updated_at":"2025-03-27T13:26:35.773Z","avatar_url":"https://github.com/zahidhasann88.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Golang Image Processing Library\n\n## Overview\nThis library provides a set of image processing functions with a RESTful API interface.\n\n```markdown\n\n## Features\n- Resize\n- Crop\n- Rotate\n- Blur\n- Grayscale\n- Sharpen\n- Authentication with JWT\n- Rate limiting\n\n## Installation\n```bash\ngo mod tidy\n```\n\n## Docker Installation and Deployment\n\n### Prerequisites\nMake sure you have Docker installed on your machine. You can download it from [Docker's official website](https://www.docker.com/products/docker-desktop).\n\n### Build Docker Image\nTo build the Docker image for the server, navigate to the root directory of your project where the Dockerfile is located and run:\n\n- To build your Docker image:\n```bash\ndocker-compose build\n```\n\n- To start your application along with the database (if using Docker Compose):\n```bash\ndocker-compose up\n```\n\n### Alternatively, to run only your application (if not using Docker Compose):\n```bash\ndocker build -t image-processing-server .\n```\n\n### Running the Docker Container\nOnce the image is built, you can run the server in a Docker container using:\n```bash\ndocker run -p 8080:8080 -d image-processing-server\n```\nThis command maps port 8080 of the Docker container to port 8080 on your host machine. Adjust the ports as needed if your server listens on a different port.\n\n### Docker Compose\nAlternatively, you can use Docker Compose for managing your application stack. Create a `docker-compose.yml` file in your project directory with the following content:\n```yaml\nversion: '3'\nservices:\n  image-processing:\n    image: image-processing-server\n    ports:\n      - \"8080:8080\"\n    environment:\n      DATABASE_URL: \"postgres://user:password@localhost/dbname?sslmode=disable\"\n      JWT_SECRET: \"my_secret_key\"\n    depends_on:\n      - postgres\n  postgres:\n    image: postgres\n    environment:\n      POSTGRES_USER: user\n      POSTGRES_PASSWORD: password\n      POSTGRES_DB: dbname\n    ports:\n      - \"5432:5432\"\n```\nThis Docker Compose configuration sets up two services: `image-processing` for your Golang application and `postgres` for your PostgreSQL database. Adjust the environment variables and ports according to your setup.\n\n## Using Makefile\n\n## Endpoints\n- Prerequisites\nTo use the Makefile on Windows, you need a tool that supports the make command. You can use one of the following methods:\n\n1. Install Make for Windows:\n- Download and install Make for Windows from GnuWin.\n- Add the path to the make executable to your system's PATH environment variable.\n\n2. Use Git Bash:\n- Install Git for Windows from git-scm.com.\n- Open Git Bash.\n\n3.  Use Windows Subsystem for Linux (WSL):\nEnable the Windows Subsystem for Linux and install a Linux distribution from the Microsoft Store.\nOpen your WSL terminal.\n\n## Running Makefile Commands\n1. Open your terminal (Git Bash, Command Prompt, or WSL).\n2. Navigate to your project directory\n```bash\ncd path\\to\\your\\project\n```\n3. Run the make command\n```bash\nmake run\n```\n\n## Makefile Commands\n- make run: Run the server.\n- make test: Run the tests.\n- make build: Build the application.\n- make clean: Clean the build artifacts.\n\n## Running the Server\nIf you prefer to run the server outside of Docker, you can still do so using:\n```bash\ngo run cmd/server/main.go\n```\n\n## Build Steps\n- Build the Application: Use the go build command to compile your application into an executable binary. Run the following command:\n```bash\ngo build -o image-processing-app cmd/server/main.go\n```\n- Run the Application: Once built, you can run the application directly from the command line. For example:\n```bash\n./image-processing-app\n```\n\n## Endpoints\n\n### Authentication\n- **POST /register**: Register a new user\n  - **Request Body**:\n    ```json\n    {\n      \"username\": \"example\",\n      \"password\": \"password123\"\n    }\n    ```\n  - **Response**:\n    ```json\n    {\n      \"message\": \"User registered successfully\"\n    }\n    ```\n\n- **POST /login**: Login and get a token\n  - **Request Body**:\n    ```json\n    {\n      \"username\": \"example\",\n      \"password\": \"password123\"\n    }\n    ```\n  - **Response**:\n    ```json\n    {\n      \"token\": \"your_jwt_token\"\n    }\n    ```\n\n### Image Processing\n- **POST /upload**: Upload and process a single image\n  - **Authorization**: Bearer Token\n  - **Request Body (form-data)**:\n    - **Key**: `image` | **Value**: Select a file | **Type**: File\n    - Additional keys (optional): `resize`, `crop`, `rotate`, `blur`, `grayscale`, `sharpen`\n  - **Response**:\n    ```json\n    {\n      \"message\": \"Image processed successfully\",\n      \"url\": \"http://localhost:8080/uploads/processed-image.jpg\"\n    }\n    ```\n\n- **POST /batch-upload**: Upload and process multiple images\n  - **Authorization**: Bearer Token\n  - **Request Body (form-data)**:\n    - **Key**: `images` | **Value**: Select multiple files | **Type**: File\n    - Additional keys (optional): `resize`, `crop`, `rotate`, `blur`, `grayscale`, `sharpen`\n  - **Response**:\n    ```json\n    {\n      \"message\": \"Batch processing completed successfully\"\n    }\n    ```\n\n- **POST /async-upload**: Upload and process images asynchronously\n  - **Authorization**: Bearer Token\n  - **Request Body (form-data)**:\n    - **Key**: `images` | **Value**: Select multiple files | **Type**: File\n    - Additional keys (optional): `resize`, `crop`, `rotate`, `blur`, `grayscale`, `sharpen`\n  - **Response**:\n    ```json\n    {\n      \"message\": \"Images are being processed\"\n    }\n    ```\n\n## Configuration\n### Create a .env file with the following content:\n```bash\nDATABASE_URL=postgres://user:password@localhost/dbname?sslmode=disable\nJWT_SECRET=my_secret_key\n```\n\n### Create a Postgres Database (Example Name: imgproc)\n#### Run the SQL query\n```sql\nCREATE TABLE users (\n    id SERIAL PRIMARY KEY,\n    username VARCHAR(50) UNIQUE NOT NULL,\n    password VARCHAR(255) NOT NULL,\n    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n## Testing with Postman\n\n### 1. Register a New User\n- **Method**: POST\n- **URL**: `http://localhost:8080/register`\n- **Body**: \n  ```json\n  {\n    \"username\": \"example\",\n    \"password\": \"password123\"\n  }\n  ```\n\n### 2. Login and Get a Token\n- **Method**: POST\n- **URL**: `http://localhost:8080/login`\n- **Body**: \n  ```json\n  {\n    \"username\": \"example\",\n    \"password\": \"password123\"\n  }\n  ```\n- **Response**:\n  ```json\n  {\n    \"token\": \"your_jwt_token\"\n  }\n  ```\n\n### 3. Upload and Process a Single Image\n- **Method**: POST\n- **URL**: `http://localhost:8080/upload`\n- **Authorization**: Bearer Token\n- **Body**: \n  - **Type**: form-data\n  - **Key**: `image` | **Value**: Select a file | **Type**: File\n  - Additional keys (optional): `resize`, `crop`, `rotate`, `blur`, `grayscale`, `sharpen`\n\n### 4. Batch Upload and Process Multiple Images\n- **Method**: POST\n- **URL**: `http://localhost:8080/batch-upload`\n- **Authorization**: Bearer Token\n- **Body**: \n  - **Type**: form-data\n  - **Key**: `images` | **Value**: Select multiple files | **Type**: File\n  - Additional keys (optional): `resize`, `crop`, `rotate`, `blur`, `grayscale`, `sharpen`\n\n### 5. Asynchronous Upload and Process Images\n- **Method**: POST\n- **URL**: `http://localhost:8080/async-upload`\n- **Authorization**: Bearer Token\n- **Body**: \n  - **Type**: form-data\n  - **Key**: `images` | **Value**: Select multiple files | **Type**: File\n  - Additional keys (optional): `resize`, `crop`, `rotate`, `blur`, `grayscale`, `sharpen`\n```\n\nThis README.md file now includes Docker installation and deployment instructions specific to your Golang Image Processing Library project, alongside existing instructions for running the server, endpoints, configuration, and testing with Postman. Adjust paths and settings as necessary for your specific environment.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahidhasann88%2Fgo-image-processing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzahidhasann88%2Fgo-image-processing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahidhasann88%2Fgo-image-processing/lists"}