{"id":34131665,"url":"https://github.com/shlason/imgproxy","last_synced_at":"2026-05-28T08:31:51.123Z","repository":{"id":65349635,"uuid":"543931045","full_name":"shlason/imgproxy","owner":"shlason","description":"一個可以將儲存在任一地方的圖片進行縮放和套用濾鏡，而不用額外儲存圖片的簡易 proxy server","archived":false,"fork":false,"pushed_at":"2022-12-09T05:57:47.000Z","size":1513,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-29T21:49:38.902Z","etag":null,"topics":["golang","image-processing","proxy-server","side-project"],"latest_commit_sha":null,"homepage":"https://imgproxy.sidesideeffect.io","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/shlason.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":"2022-10-01T07:19:51.000Z","updated_at":"2025-07-21T15:26:44.000Z","dependencies_parsed_at":"2023-01-25T11:46:31.756Z","dependency_job_id":null,"html_url":"https://github.com/shlason/imgproxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shlason/imgproxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlason%2Fimgproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlason%2Fimgproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlason%2Fimgproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlason%2Fimgproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shlason","download_url":"https://codeload.github.com/shlason/imgproxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlason%2Fimgproxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33601380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["golang","image-processing","proxy-server","side-project"],"created_at":"2025-12-15T00:57:18.085Z","updated_at":"2026-05-28T08:31:51.118Z","avatar_url":"https://github.com/shlason.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# imgproxy\n\n一個可以將儲存在任一地方的圖片進行縮放和套用濾鏡，而不用額外儲存圖片的簡易 proxy server。\n\nAPI 文件：[點我](https://imgproxy.sidesideeffect.io/swagger/index.html)\n\n在左下方 Original image 輸入欲縮放的 image URL，線上 Demo: [點我](https://imgproxy.sidesideeffect.io/)\n\n![imgproxy demo image](https://raw.githubusercontent.com/shlason/imgproxy/docs/images/demo.png)\n\n## 動機\n例如有個網站是專門搜集攝影作品，但攝影作品的圖片檔案普遍都非常大，若每次在前端顯示作品縮圖之類，不需要原圖畫質的情境時，會耗費很多不必要的網路流量且載入慢導致使用體驗相對不佳，這個問題可以在上傳作品時就分成很多不同 size 的圖片來儲存，在不同情境就使用相對應 size，但這樣就會多耗費空間來為每個作品做不同 size 的圖片儲存。\n\n## 解法\nimgproxy 可以藉由 QS 來指定特定圖片要取得什麼樣的 size，以及縮放的規則，而不用特別把圖片分為不同 size 一一儲存，不僅不用額外耗費儲存空間也增加了彈性，日後不管要什麼 size 的圖片都可以支援。\n\n因為影像處理的部分，相對都比較耗費機器的效能，所以使用 Cloudflare CDN 來做快取，變成只有在全新的請求時才需處理，用以減緩機器的負擔。\n\nAPI 使用上，例如我有一個攝影作品 A，在顯示作品 A 的縮圖時可以這樣做：\n```\nhttps://imgproxy.sidesideeffect.io/api/image?url={IMAGE_A_URL}\u0026width={W}\u0026height={H}\u0026resize=fit\u0026blur=0\n\nIMAGE_A_URL: 作品 A 原圖的 URL\nW:           欲縮放的寬度\nH:           欲縮放的高度\n並且使用 fit 的方式來 resize 不導致變形及不套用模糊濾鏡\n```\n\n## 潛在問題\n若同時有多個全新的請求，並且圖片又非常大的情況下，可能機器負擔會非常大，這時候可能可以考慮把這個服務架在 AWS Lambda 上面，並一樣處理 CDN，目前該服務是建在 AWS EC2 上面。\n\n## 技術棧\n- Go\n- Gin (管理路由和 middleware)\n- h2non/bimg (影像處理)\n- `gopkg.in/ini.v1` (用來讀取設定檔 configs.ini)\n- swaggo/swag (產 API 文件)\n- autocert (產 SSL 憑證)\n- github Actions (用以 build 專案和部署到 EC2 上)\n- Cloudflare DNS\n- Cloudflare CDN\n- AWS EC2\n\n## 參考\n以前做專案時曾遇過類似問題，當初看到 [imgproxy github](https://github.com/imgproxy/imgproxy) 並在當時使用類似的方式解決了，因此想要自己試著做一個簡易的版本看看。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshlason%2Fimgproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshlason%2Fimgproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshlason%2Fimgproxy/lists"}