{"id":39060157,"url":"https://github.com/selcukusta/simple-image-server","last_synced_at":"2026-01-17T18:04:03.099Z","repository":{"id":50703787,"uuid":"264870688","full_name":"selcukusta/simple-image-server","owner":"selcukusta","description":"Host Your Own Image Server based on MongoDB, Azure Blob Storage or Google Drive","archived":false,"fork":false,"pushed_at":"2020-10-05T21:53:48.000Z","size":16602,"stargazers_count":36,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-19T00:38:51.561Z","etag":null,"topics":["azure","blob-storage","cdn","docker","google-drive","gridfs","mongodb","varnish-cache"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selcukusta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-18T08:05:09.000Z","updated_at":"2024-02-25T18:45:00.000Z","dependencies_parsed_at":"2022-09-26T21:30:13.929Z","dependency_job_id":null,"html_url":"https://github.com/selcukusta/simple-image-server","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/selcukusta/simple-image-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selcukusta%2Fsimple-image-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selcukusta%2Fsimple-image-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selcukusta%2Fsimple-image-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selcukusta%2Fsimple-image-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selcukusta","download_url":"https://codeload.github.com/selcukusta/simple-image-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selcukusta%2Fsimple-image-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28514939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T17:57:59.192Z","status":"ssl_error","status_checked_at":"2026-01-17T17:57:52.527Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["azure","blob-storage","cdn","docker","google-drive","gridfs","mongodb","varnish-cache"],"created_at":"2026-01-17T18:04:02.634Z","updated_at":"2026-01-17T18:04:03.082Z","avatar_url":"https://github.com/selcukusta.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Host Your Own Image Server based on MongoDB, Azure Blob Storage or Google Drive\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/selcukusta/simple-image-server)](https://goreportcard.com/report/github.com/selcukusta/simple-image-server)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/selcukusta/simple-image-server)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/selcukusta/simple-image-server/blob/master/LICENSE)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fselcukusta%2Fsimple-image-server.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fselcukusta%2Fsimple-image-server?ref=badge_shield)\n[![codecov](https://codecov.io/gh/selcukusta/simple-image-server/branch/master/graph/badge.svg)](https://codecov.io/gh/selcukusta/simple-image-server)\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=selcukusta_gdrive-image-server\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=selcukusta_gdrive-image-server)\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=selcukusta_gdrive-image-server\u0026metric=sqale_index)](https://sonarcloud.io/dashboard?id=selcukusta_gdrive-image-server)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=selcukusta_gdrive-image-server\u0026metric=bugs)](https://sonarcloud.io/dashboard?id=selcukusta_gdrive-image-server)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=selcukusta_gdrive-image-server\u0026metric=code_smells)](https://sonarcloud.io/dashboard?id=selcukusta_gdrive-image-server)\n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=selcukusta_gdrive-image-server\u0026metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=selcukusta_gdrive-image-server)\n\n## Getting Started\n\n### Supported Platforms\n\n- **AWS S3 Storage**\n\n- **Google Drive**\n\n- **Azure Blob Storage**\n\n- **MongoDB GridFS**\n\n### Supported Formats\n\n- **image/jpeg**\n- **image/png**\n- **image/webp**\n\n#### 💻 AWS S3 Storage\n\n##### Setup steps for using AWS S3 Storage\n\nIf you have any public S3 url such as; `https://[S3_NAME].s3.[S3_REGION].amazonaws.com/path/to/image` you need to set these environment variables:\n\n| Name        | Type     |\n| :---------- | :------- |\n| `S3_NAME`   | `string` |\n| `S3_REGION` | `string` |\n\n#### 💻 Google Drive\n\nYou need to have a Google account to set up the project.\n\n##### Setup steps for using Google Drive API\n\nFirstly, create a new project from [Google Developer Console](https://console.developers.google.com/). Go to the **Credentials** menu and create a new **Service Accounts** credential. It might be named as `[PROJECT_ALIAS]-xxxx-xxxxxxx.json`.\n\nDownload it and rename as `gcloud-image-server-cred.json`. Put the file to the **root** folder (_it will be used for building Docker image_).\n\nCopy your service account mail address (_it will be used for sharing your images with the project_).\n\n##### Setup steps for host the images\n\nGo to your Drive page and create a folder, ie. `image-server`.\n\nShare the folder with your service account (_was copied before_). Sharing rule will be applied to the all sub-items in the folder.\n\nAs a last step, upload any image (mime should be `image/jpeg` or `image/png`) to the folder and get the ID.\n\n_NOTE: `ID` is not showing anywhere in the portal, it sucks! To catch it, right click your item and select `Get Shareable Link`. Copy the last part of it, and toggle off the sharable link feature._\n\n#### 💻 Azure Blob Storage\n\n##### Setup steps for using Azure Blob Storage\n\nIf you have an Azure Account and blob storage subscription, you have to create a new Access Key from portal or CLI. It could be like that; `DefaultEndpointsProtocol=https;AccountName=[YOUR_STORAGE_NAME];AccountKey=[YOUR_ACCOUNT_KEY]==;EndpointSuffix=core.windows.net.`\n\nYou need to add these values to the environment:\n\n| Name               | Type     |\n| :----------------- | :------- |\n| `ABS_ACCOUNT_KEY`  | `string` |\n| `ABS_ACCOUNT_NAME` | `string` |\n| `ABS_AZURE_URI`    | `string` |\n\n##### Setup steps for host the images\n\nYou can create a new container from Blob service \u003e Container menus. Assume that you have a container which is named as sample-photos. It has two directories and a the picture at the last directory (_summer \u003e hotels \u003e swimming.jpg_).\n\nReach your blob with the url: `http://127.0.0.1:8080/i/abs/100/400x0/sample-photos/summer/hotels/swimming.jpg`\n\n#### 💻 MongoDB\n\nBefore running the application set these environment variables (or use `Docker` image, run with `docker container run -d --name mongodb-instance -p 27017:27017 mongo:3.6.18-xenial` and leave them default):\n\n| Name                   | Type     | Default Value               |\n| :--------------------- | :------- | :-------------------------- |\n| `MONGO_CONNECTION_STR` | `string` | _mongodb://127.0.0.1:27017_ |\n| `MONGO_DB_NAME`        | `string` | _Photos_                    |\n| `MONGO_MAX_POOL_SIZE`  | `uint64` | _5_                         |\n\nRun `go run cmd/mongo-seed/main.go` command and create 3 sample record on the DB such as;\n\n| \\_id                     | chunkSize | filename    | length | metadata                       | uploadDate               |\n| :----------------------- | :-------- | :---------- | :----- | :----------------------------- | :----------------------- |\n| 5ec684803dd893bb72ead932 | 261120    | image-3.jpg | 710863 | {\"Content-Type\": \"image/jpeg\"} | 2020-05-21T13:39:12.585Z |\n| 5ec684803dd893bb72ead931 | 261120    | image-2.jpg | 516218 | {\"Content-Type\": \"image/jpeg\"} | 2020-05-21T13:39:12.603Z |\n| 5ec684803dd893bb72ead930 | 261120    | image-1.jpg | 379373 | {\"Content-Type\": \"image/jpeg\"} | 2020-05-21T13:39:12.617Z |\n\n## Running\n\n### Via Docker\n\n#### Build\n\n```bash\n# Build the image with Google Drive and WebP support. gcloud-image-server-cred.json file should be included!\ndocker image build -t [YOUR_REPOSITORY]/w-gdrive-w-webp:1.0.0 -f w-gdrive-w-webp.Dockerfile .\n# Build the image with Google Drive without WebP support. gcloud-image-server-cred.json file should be included!\ndocker image build -t [YOUR_REPOSITORY]/w-gdrive-wo-webp:1.0.0 -f w-gdrive-wo-webp.Dockerfile .\n# Build the image without Google Drive and with WebP support.\ndocker image build -t [YOUR_REPOSITORY]/wo-gdrive-w-webp:1.0.0 -f wo-gdrive-w-webp.Dockerfile .\n# Build the image without Google Drive and withoutt WebP support.\ndocker image build -t [YOUR_REPOSITORY]/wo-gdrive-wo-webp:1.0.0 -f wo-gdrive-wo-webp.Dockerfile .\n```\n\n#### Run\n\n```bash\ndocker container run -p 8080:8080 --rm [YOUR_REPOSITORY]/w-gdrive-w-webp:1.0.0\ndocker container run -p 8080:8080 --rm [YOUR_REPOSITORY]/w-gdrive-wo-webp:1.0.0\ndocker container run -p 8080:8080 --rm [YOUR_REPOSITORY]/wo-gdrive-w-webp:1.0.0\ndocker container run -p 8080:8080 --rm [YOUR_REPOSITORY]/wo-gdrive-wo-webp:1.0.0\n```\n\n### Via Docker Compose\n\n- `docker-compose up`\n\n- Go to your favorite browser\n\n- Surf to the URLs such as below.\n\nThree containers will be bringing up. The first one is your image server application. It was written with purely **[the Go programming language](https://golang.org/)**. It can be reached with _[http://localhost:8080/version](http://localhost:8080/version)_\n\nAnother one is **[Varnish HTTP Cache](https://varnish-cache.org/)**. It will automatically cache the output of the response for 14 days. It can be reached with _[http://localhost:8081/version](http://localhost:8081/version)_\n\nThe latest one, **[nuster](https://github.com/jiangwenyuan/nuster)**. Nuster, a high-performance HTTP proxy cache server and RESTful NoSQL cache server based on HAProxy. It will automatically cache the output of the response for 14 days like Varnish. It can be reached with _[http://localhost:8082/version](http://localhost:8082/version)_\n\n_You can choose any cache server according to your experience._\n\n## Usage\n\n/i/ endpoint is used for image operations, has four different usages:\n\n### AWS S3 Storage\n\n```\n/i/s3/webp/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{options:opt}/{*id}\n\n/i/s3/webp/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{*id}\n\n/i/s3/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{options:opt}/{*id}\n\n/i/s3/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{*id}\n```\n\n### Google Drive\n\n```\n/i/gdrive/webp/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{options:opt}/{*id}\n\n/i/gdrive/webp/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{*id}\n\n/i/gdrive/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{options:opt}/{*id}\n\n/i/gdrive/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{*id}\n```\n\n### Azure Blob Storage\n\n```\n/i/abs/webp/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{options:opt}/{*id}\n\n/i/abs/webp/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{*id}\n\n/i/abs/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{options:opt}/{*id}\n\n/i/abs/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{*id}\n```\n\n### MongoDB\n\n```\n/i/gridfs/webp/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{options:opt}/{*id}\n\n/i/gridfs/webp/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{*id}\n\n/i/gridfs/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{options:opt}/{*id}\n\n/i/gridfs/{quality:range(0,100)}/{w:range(0,5000)}x{h:range(0,5000)}/{*id}\n```\n\n## WebP Support\n\nIf you add `/webp/` path to the URL, you can get the image as webp.\n\n## Options\n\n| Option | Description                                                                                                                 |\n| ------ | --------------------------------------------------------------------------------------------------------------------------- |\n| `g`    | This will convert the given image into a grayscale image.                                                                   |\n| `t`    | This will scales the image up or down, crops it to the specified width and hight and returns the transformed image.         |\n| `c`    | This will cuts out a rectangular region with the specified size from the center of the image and returns the cropped image. |\n\n## Samples\n\n- **Original size:** `http://127.0.0.1:8080/i/s3/100/0x0/[PATH_TO_IMAGE]`, `http://127.0.0.1:8080/i/gdrive/100/0x0/[YOUR_FILE_ID]`, `http://127.0.0.1:8080/i/gridfs/100/0x0/[MONGODB_OBJECT_ID]` or `http://127.0.0.1:8080/i/abs/100/0x0/[YOUR_STORAGE_PATH]`\n\n![1](assets/1.png)\n\n- **Resize with aspect ratio:** `http://127.0.0.1:8080/i/s3/100/500x0/[PATH_TO_IMAGE]`, `http://127.0.0.1:8080/i/gdrive/100/500x0/[YOUR_FILE_ID]`, `http://127.0.0.1:8080/i/gridfs/100/500x0/[MONGODB_OBJECT_ID]` or `http://127.0.0.1:8080/i/abs/100/500x0/[YOUR_STORAGE_PATH]`\n\n![2](assets/2.png)\n\n- **Less quality:** `http://127.0.0.1:8080/i/s3/1/0x0/[PATH_TO_IMAGE]`, `http://127.0.0.1:8080/i/gdrive/1/0x0/[YOUR_FILE_ID]`, `http://127.0.0.1:8080/i/gridfs/1/0x0/[MONGODB_OBJECT_ID]` or `http://127.0.0.1:8080/i/abs/1/0x0/[YOUR_STORAGE_PATH]`\n\n![3](assets/3.png)\n\n- **Resize without aspect ratio:** `http://127.0.0.1:8080/i/s3/100/1600x600/[PATH_TO_IMAGE]`, `http://127.0.0.1:8080/i/gdrive/100/1600x600/[YOUR_FILE_ID]`, `http://127.0.0.1:8080/i/gridfs/100/1600x600/[MONGODB_OBJECT_ID]` or `http://127.0.0.1:8080/i/abs/100/1600x600/[YOUR_STORAGE_PATH]`\n\n![4](assets/4.png)\n\n- **Resize with crop:** `http://127.0.0.1:8080/i/s3/100/1600x600/c/[PATH_TO_IMAGE]`, `http://127.0.0.1:8080/i/gdrive/100/1600x600/c/[YOUR_FILE_ID]`, `http://127.0.0.1:8080/i/gridfs/100/1600x600/c/[MONGODB_OBJECT_ID]` or `http://127.0.0.1:8080/i/abs/100/1600x600/c/[YOUR_STORAGE_PATH]`\n\n![5](assets/5.png)\n\n- **Create thumbnail with aspect ratio:** `http://127.0.0.1:8080/i/s3/100/0x300/t/[PATH_TO_IMAGE]`, `http://127.0.0.1:8080/i/gdrive/100/0x300/t/[YOUR_FILE_ID]`, `http://127.0.0.1:8080/i/gridfs/100/0x300/t/[MONGODB_OBJECT_ID]` or `http://127.0.0.1:8080/i/abs/100/0x300/t/[YOUR_STORAGE_PATH]`\n\n![6](assets/6.png)\n\n- **Grayscale:** `http://127.0.0.1:8080/i/s3/100/900x0/g/[PATH_TO_IMAGE]`, `http://127.0.0.1:8080/i/gdrive/100/900x0/g/[YOUR_FILE_ID]`, `http://127.0.0.1:8080/i/gridfs/100/900x0/g/[MONGODB_OBJECT_ID]` or `http://127.0.0.1:8080/i/abs/100/900x0/g/[YOUR_STORAGE_PATH]`\n\n![7](assets/7.png)\n\n## LICENSE\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fselcukusta%2Fgdrive-image-server.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fselcukusta%2Fgdrive-image-server?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselcukusta%2Fsimple-image-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselcukusta%2Fsimple-image-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselcukusta%2Fsimple-image-server/lists"}