{"id":13453320,"url":"https://github.com/ccbikai/cloudflare-worker-image","last_synced_at":"2025-04-04T08:02:51.933Z","repository":{"id":209001104,"uuid":"721994577","full_name":"ccbikai/cloudflare-worker-image","owner":"ccbikai","description":"使用 Cloudflare Worker 处理图片, 依赖 Photon，支持缩放、剪裁、水印、滤镜等功能。","archived":false,"fork":false,"pushed_at":"2024-11-07T11:12:31.000Z","size":25,"stargazers_count":217,"open_issues_count":2,"forks_count":38,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T07:01:49.066Z","etag":null,"topics":["cloudflare","cloudflare-workers","image","image-processing","worker"],"latest_commit_sha":null,"homepage":"https://chi.miantiao.me/posts/cloudflare-worker-image/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ccbikai.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":"2023-11-22T08:05:08.000Z","updated_at":"2025-03-26T06:23:55.000Z","dependencies_parsed_at":"2023-11-28T07:25:03.177Z","dependency_job_id":"cdcafb87-9849-4f3c-bd7c-b9555652daaa","html_url":"https://github.com/ccbikai/cloudflare-worker-image","commit_stats":{"total_commits":16,"total_committers":3,"mean_commits":5.333333333333333,"dds":0.5,"last_synced_commit":"1d4eff4abbe22d6457cee21344fa9ff583ebe842"},"previous_names":["ccbikai/cloudflare-worker-image"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccbikai%2Fcloudflare-worker-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccbikai%2Fcloudflare-worker-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccbikai%2Fcloudflare-worker-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccbikai%2Fcloudflare-worker-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccbikai","download_url":"https://codeload.github.com/ccbikai/cloudflare-worker-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135732,"owners_count":20889541,"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":["cloudflare","cloudflare-workers","image","image-processing","worker"],"created_at":"2024-07-31T08:00:38.008Z","updated_at":"2025-04-04T08:02:51.909Z","avatar_url":"https://github.com/ccbikai.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/ccbikai"],"categories":["Rust","�🖼️ 图床与媒体处理","Bildhosting"],"sub_categories":[],"readme":"# Cloudflare Worker Image\n\n使用 Cloudflare Worker 处理图片, 依赖 Photon，支持缩放、剪裁、水印、滤镜等功能。\n\n---\n\n![Cloudflare Workers](https://img.shields.io/badge/Cloudflare-F69652?style=flat\u0026logo=cloudflare\u0026logoColor=white)\n![GitHub License](https://img.shields.io/github/license/ccbikai/cloudflare-worker-image)\n![GitHub Repo stars](https://img.shields.io/github/stars/ccbikai/cloudflare-worker-image)\n\n\u003e 已经适配了 Vercel Edge, 见 \u003chttps://github.com/ccbikai/vercel-edge-image\u003e 。\n\n## 支持特性\n\n1. 支持 PNG、JPEG、BMP、ICO、TIFF 格式图片处理\n2. 可输出 JPEG、PNG、WEBP 格式图片，默认输出 WEBP 格式图片\n3. 支持管道操作，可以执行多个操作\n4. 支持 Cloudflare 缓存\n5. 支持图片地址白名单，防滥用\n6. 异常降级，如果处理失败返回原图（异常场景不缓存）\n\n## 部署方式\n\n```sh\n# patch 功能依赖 pnpm, 如果不使用 pnpm, 需要自己处理 patch-package https://www.npmjs.com/package/patch-package\nnpm i -g pnpm\n\n# 克隆此项目\ngit clone https://github.com/ccbikai/cloudflare-worker-image.git\ncd cloudflare-worker-image\n\n# 安装依赖\npnpm install\n\n# 修改白名单配置，改为图片域名或者留空不限制图片地址\nvi wrangler.toml # WHITE_LIST\n\n# 发布\nnpm run deploy\n```\n\n## 使用方式\n\n修改域名和参数即可使用, 参考：\u003chttps://image.miantiao.me/?url=https%3A%2F%2Fstatic.miantiao.me%2Fshare%2FMTyerw%2Fbanner-2048.jpeg\u0026action=resize!830,400,2\u003e\n\n### 参数说明\n\nurl:\n\u003e 原图地址，需要使用 encodeURIComponent 编码\n\naction:\n\u003e 操作指令, 支持 [Photon](https://docs.rs/photon-rs/latest/photon_rs/) 各种操作指令，指令与参数直接使用`!`分割，参考 `resize!830,400,2`\n\u003e\n\u003e 支持管道操作，多个操作指令使用`|`分割，参考 `resize!830,400,2|watermark!https%3A%2F%2Fstatic.miantiao.me%2Fshare%2F6qIq4w%2FFhSUzU.png,10,10`\n\u003e\n\u003e 如果参数中有 URL 或其他特殊字符，需要使用 encodeURIComponent 编码 URL 和 特殊字符\n\nformat:\n\u003e 输出图片格式，支持：`jpg,webp,png`，可选，默认 webp\n\nquality:\n\u003e 图片质量，1-100 只有 webp 和 jpg 格式支持，可选，默认 99\n\n## 演示\n\n### 缩放+旋转+文字水印\n\n![demo](https://image.miantiao.me/?url=https%3A%2F%2Fstatic.miantiao.me%2Fshare%2FMTyerw%2Fbanner-2048.jpeg\u0026action=resize!830,400,2%7Crotate!180%7Cdraw_text!miantiao.me,10,10)\n\n由于 Github 会缓存图片，请前往我博客查看真实示例。\n\n\u003chttp://chi.miantiao.me/post/cloudflare-worker-image/\u003e\n\n## 致谢\n\n- [Cloudflare](https://www.cloudflare.com)\n- [photon](https://github.com/silvia-odwyer/photon)\n- [jSquash](https://github.com/jamsinclair/jSquash)\n\n---\n\n[![Buy Me A Coffee](https://static.miantiao.me/share/0WmsVP/CcmGr8.png)](https://www.buymeacoffee.com/ccbikai)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccbikai%2Fcloudflare-worker-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccbikai%2Fcloudflare-worker-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccbikai%2Fcloudflare-worker-image/lists"}