{"id":24501472,"url":"https://github.com/turbokirichenko/image-serve","last_synced_at":"2025-03-15T07:26:04.238Z","repository":{"id":235846239,"uuid":"791373106","full_name":"turbokirichenko/image-serve","owner":"turbokirichenko","description":"Openresty service for image processing using the imagick library","archived":false,"fork":false,"pushed_at":"2024-04-24T15:57:39.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T22:35:07.067Z","etag":null,"topics":["imagick","lua","openresty","resty"],"latest_commit_sha":null,"homepage":"https://github.com/turbokirichenko/image-serve/blob/main/README.md","language":"Lua","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/turbokirichenko.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-04-24T15:47:35.000Z","updated_at":"2024-06-06T21:51:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"1fa6556d-2ba1-44fc-98c5-dc63a38d5918","html_url":"https://github.com/turbokirichenko/image-serve","commit_stats":null,"previous_names":["turbokirichenko/image-serve"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turbokirichenko%2Fimage-serve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turbokirichenko%2Fimage-serve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turbokirichenko%2Fimage-serve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turbokirichenko%2Fimage-serve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/turbokirichenko","download_url":"https://codeload.github.com/turbokirichenko/image-serve/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243698154,"owners_count":20333068,"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":["imagick","lua","openresty","resty"],"created_at":"2025-01-21T22:29:30.893Z","updated_at":"2025-03-15T07:26:04.219Z","avatar_url":"https://github.com/turbokirichenko.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Openresty service to serve images\n\n\u003ch3 style=\"color: #B2B2B280\"\u003eIt is a simple reverse proxy server for image processing\u003c/h3\u003e\n\n## Key Purposes\n\n\u003cul style=\"color: #BB8800\"\u003e\n    \u003cli\u003e\u003cb \u003eProvide the fast way to edit images from the external source\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eMinimise size of the image\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eChange image extention\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eChenge default dimention of image\u003c/b\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n## Deploy\n\n\u003cb style=\"color: #F93030\"\u003eNOTE: Recommended to use deployment via Dockerfile\u003c/b\u003e\n\n```bash\ngit clone http://github.com/turbokirichenko/static-serve.git\ncd ./static-serve\ndocker buildx build --tag \"static-serve\" .\ndocker run -d -p 8082:8080 -n \"image-service\" static-serve\n```\n\n## Usage\n\n\u003cb style=\"color: #F9F9F9\"\u003eFirst of all encode the url of a static resource in base64 encoding:\u003c/b\u003e\n\n```bash\n$ echo -n 'https://avatars.githubusercontent.com/u/92226824?v=4' | base64\n\n# aHR0cDovL2ltYWdlc291cmNlL25hbWUuanBn\n```\n\n\u003cb style=\"color: #F9F9F9\"\u003eNow you can interract with the service by simply API: \u003c/b\u003e\n\n```js\n/** HTTP GET /image/\u003cbase64Url\u003e/?...\n *\n * @param {string} base64url - is external image url in base64 encoding\n * @param {string | undefined} ext - new extention of the image (see MIMIE TYPES...)\n * @param {number | undefined} w - new width of the image\n * @param {number | undefined} h - new height of the image\n *\n * NOTE: service will resize image proportionally!\n *\n *\n * RESPONSE 200 OK\n */\n```\n\n\u003cb style=\"color: #F93030\"\u003eNOTE: service will resize image proportionally!\u003c/b\u003e\n\u003cbr /\u003e\n\u003cb\u003eExample:\u003c/b\u003e\n\u003cbr /\u003e\n\n```bash\n$ curl -v -X GET \"http://localhost:8082/image/aHR0cHM6Ly9hdmF0YXJzLmdpdGh1YnVzZXJjb250ZW50LmNvbS91LzkyMjI2ODI0P3Y9NA==?w\n=200\u0026ext=jpg\" --output ./avatar.jpg\nNote: Unnecessary use of -X or --request, GET is already inferred.\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1:8082...\n* Connected to localhost (127.0.0.1) port 8082 (#0)\n\u003e GET /image/aHR0cHM6Ly9hdmF0YXJzLmdpdGh1YnVzZXJjb250ZW50LmNvbS91LzkyMjI2ODI0P3Y9NA==?w=200\u0026ext=avif HTTP/1.1\n\u003e Host: localhost:8082\n\u003e User-Agent: curl/7.75.0\n\u003e Accept: */*\n\u003e\n* Mark bundle as not supporting multiuse\n\u003c HTTP/1.1 200 OK\n\u003c Server: openresty/1.21.4.1\n\u003c Date: Wed, 24 Apr 2024 15:35:26 GMT\n\u003c Content-Type: image/avif\n\u003c Content-Length: 1009\n\u003c Connection: keep-alive\n\u003c\n{ [1009 bytes data]\n100  1009  100  1009    0     0   2287      0 --:--:-- --:--:-- --:--:--  2293\n* Connection #0 to host localhost left intact\n```\n\n\u003cb\u003eResult:\u003c/b\u003e\n![result image](https://github.com/turbokirichenko/image-serve/blob/main/avatar.jpg)\n\n## Mime Types\n\n\u003cb style=\"color: #F9F9F9\"\u003eThere are available Mime Types:\u003c/b\u003e\n\n```lua\nmime_types = {\n    apng = 'image/apng',\n    avif = 'image/avif',\n    gif = 'image/gif',\n    png = 'image/png',\n    jpg = 'image/jpg',\n    jpeg = 'image/jpg',\n    jfif = 'image/jpg',\n    pjpeg = 'image/jpg',\n    svg = 'image/svg+xml',\n    webp = 'image/webp',\n    bmp = 'image/bmp',\n    ico = 'image/x-icon',\n    cur = 'image/x-icon',\n    tif = 'image/tiff',\n    tiff = 'image/tiff',\n}\n```\n\n## ERROR\n\n\u003cb\u003eYou will get this image if the service returns an error:\u003c/b\u003e\n\n![error image](https://github.com/turbokirichenko/image-serve/blob/main/www/static/400.jpg)\n\n\u003cbr /\u003e\n\u003cb\u003eTo change default error image, just replace it from www/static/400.jpg\u003c/b\u003e\n\n\u003cbr /\u003e\n\u003cb style=\"color: #F93030\"\u003eNOTE: to more imformation about an error see: \u003ci\u003e'/var/log/nginx/error.log'\u003c/i\u003e!\u003c/b\u003e\n\n## LOGS\n\n- Access: \u003cb\u003e/var/log/nginx/amedia.log\u003c/b\u003e\n- Error: \u003cb\u003e/var/log/nginx/error.log\u003c/b\u003e\n\n## TODO\n\n\u003cul style=\"color: #FF8800\"\u003e\n    \u003cli\u003e\u003cb\u003eENV variables\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eE2E tests\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eTo increase the number of commands\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eCLI version\u003c/b\u003e\u003c/li\u003e\n\u003c/ul\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fturbokirichenko%2Fimage-serve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fturbokirichenko%2Fimage-serve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fturbokirichenko%2Fimage-serve/lists"}