mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
2.5 KiB
2.5 KiB
description, i18n_source_hash, i18n_provenance, i18n_output_hash
| description | i18n_source_hash | i18n_provenance | i18n_output_hash |
|---|---|---|---|
| 使用模式範本重新命名多個檔案並以 ZIP 下載。 | 2776dcc2f71c | human | 767ee191db72 |
Bulk Rename
使用帶有索引、補零索引及原始檔名預留位置的模式範本重新命名多個檔案。回傳包含所有已重新命名檔案的 ZIP 壓縮檔。
API Endpoint
POST /api/v1/tools/image/bulk-rename
接受包含多個檔案及 JSON settings 欄位的 multipart form data。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| pattern | string | No | "image-{{index}}" |
帶有預留位置的命名模式(最多 1000 個字元) |
| startIndex | number | No | 1 |
起始索引編號 |
Pattern Placeholders
| Placeholder | Description | Example |
|---|---|---|
{{index}} |
從 startIndex 開始的序號 |
1、2、3 |
{{padded}} |
補零的序號 | 01、02、03 |
{{original}} |
不含副檔名的原始檔名 | photo、IMG_001 |
原始檔案副檔名一律會保留。
Example Request
curl -X POST http://localhost:1349/api/v1/tools/image/bulk-rename \
-H "Authorization: Bearer si_your-api-key" \
-F "file=@photo1.jpg" \
-F "file=@photo2.jpg" \
-F "file=@photo3.jpg" \
-F 'settings={"pattern": "vacation-{{padded}}", "startIndex": 1}'
這會產生:vacation-1.jpg、vacation-2.jpg、vacation-3.jpg
使用原始檔名:
curl -X POST http://localhost:1349/api/v1/tools/image/bulk-rename \
-H "Authorization: Bearer si_your-api-key" \
-F "file=@IMG_001.jpg" \
-F "file=@IMG_002.jpg" \
-F 'settings={"pattern": "2024-trip-{{original}}-{{index}}"}'
這會產生:2024-trip-IMG_001-1.jpg、2024-trip-IMG_002-2.jpg
Example Response
回應是直接串流的 ZIP 檔案(而非 JSON 回應)。回應標頭為:
Content-Type: application/zip
Content-Disposition: attachment; filename="renamed-a1b2c3d4.zip"
Notes
- 此工具不會處理影像。它只會重新命名檔案並將其打包成 ZIP 壓縮檔。
{{padded}}的補零寬度會根據檔案總數自動決定(例如 100 個檔案會使用 3 位數補零:001、002等)。- 檔案副檔名會從原始檔名保留。
- 檔名會經過清理以移除不安全的字元。
- 至少必須提供一個檔案。