{"id":17962424,"url":"https://github.com/grafov/image-resize-service","last_synced_at":"2025-04-03T19:19:54.581Z","repository":{"id":145323398,"uuid":"133550624","full_name":"grafov/image-resize-service","owner":"grafov","description":"The example of image resizing HTTP-service in Go","archived":false,"fork":false,"pushed_at":"2018-05-16T15:26:10.000Z","size":1377,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T07:24:26.094Z","etag":null,"topics":["example","learning-go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafov.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-15T17:28:53.000Z","updated_at":"2019-04-20T10:43:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"3eb4c5af-ba85-4c44-992a-fc68f4ab4c81","html_url":"https://github.com/grafov/image-resize-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fimage-resize-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fimage-resize-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fimage-resize-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fimage-resize-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafov","download_url":"https://codeload.github.com/grafov/image-resize-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247061882,"owners_count":20877176,"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":["example","learning-go"],"created_at":"2024-10-29T11:19:20.876Z","updated_at":"2025-04-03T19:19:54.551Z","avatar_url":"https://github.com/grafov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example of Image Resizing Service in Go language\n\nThe code was written as the sample for the job interview. The code\ndemonstrates:\n* using of HTTP-server and HTTP-client with Go sldlib\n* advice client for cache results with using Etag\n* inmem caching of the results with limited cache size and LRU [github.com/coocood/freecache](https://github.com/coocood/freecache)\n* JPEG resizing with library\n  [github.com/nfnt/resize](https://github.com/nfnt/resize)\n\nThe service has single HTTP-handler `GET /resize` that accepts `url`\nparameter that should pointe to a resource with JPEG-image. It loads\nthe image, resizes it as requested with `w` and `h` parameters and\nreturns the result.\n\nThe code is short and clean but verbosely commented so you could use\nit for studying topics of Go programming related for handling HTTP\nrequests and simple image processing.\n\nThe benchmarks below useful for wise choising of the image\nmanipulation library:\n\nhttps://github.com/fawick/speedtest-resize\n\nI've choosen the image lib not wisely :) The `github.com/nfnt/resize`\nis not a fastest and it is unmaintained for awhile so for production\nuses it is better to pick up something different.\n\nThis code of this image resizer is public domain. I have no plans to\nadd more features or maintain it. If you really looking for fully\nfunctional image resizing service in Go follow the links:\n\n* https://github.com/thoas/picfit\n* https://github.com/willnorris/imageproxy\n\n## Some hints for Go newcomers who could follow this sample code\n\n* With small codebase don't split the code by packages early. It is\n  maybe good practice in Python and mandatory in Java but Go doesn't\n  require you do what you don't need. The small code looks good in\n  `main` package.\n* Keep the `main()` as small as possible. Move all to functions in\n  other files.\n* Use `TestMain()` (was introduced in Go 1.4 but I rarely see it in\n  the tests) when you want make blackbox-like testing. `TestMain()`\n  will help you set up testing environment like if you `go build` and\n  run you code.\n* Even with small codebase put your dependencies to `vendor`\n  package. First way is exclude this folder from version control but\n  don't forget to clean it regulary for avoid possible local changes\n  inside `vendor`. Second way is include `vendor` into version control\n  so VCS will help your check that changed after each dependency\n  update. I prefer the second way for the code with small and medium\n  number of dependencies (`govendor` utility does it this way). For\n  large number of dependencies is better keep them out of version\n  control.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafov%2Fimage-resize-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafov%2Fimage-resize-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafov%2Fimage-resize-service/lists"}