🌿 Life — 2026年4月
2026-04-13 Share-pic Shortcut Flow tags:[iphone, git, picture]
上傳 iPhone 照片到 GitHub repository 的 iOS 捷徑。
– 完整流程
-
- Receive Images from Share Sheet
- Type:
Images -
If there’s no input:
Continue -
- Format Current Date
- Date Format:
Custom - Format String:
yyyyMMdd_HHmmss -
Locale:
Default -
- Repeat with each item in
Shortcut Input
- Repeat with each item in
以下步驟全部在迴圈內
– 3-1. URL
https://api.github.com/repos/rex4ssd/github_picture/contents/[Formatted Date]_[Repeat Index].jpg
– 3-2. Convert Repeat Item to JPEG
– 3-3. Encode Converted Image with base64
- Line Breaks:
None
– 3-4. Set Variable
- Name:
ImageBase64 -
Value:
Base64 Encoded - 3-5. Get Contents of URL
- Method:
PUT - Headers:
Authorization:Bearer ghp_xxxxxxAccept:application/vnd.github+json
- Request Body:
JSONmessage:Auto upload from iPhonecontent:[ImageBase64]
- 3-6. Show Alert
-
Message:
Contents of URL -
- End Repeat
- 重點筆記
| 問題 | 原因 | 解法 |
|---|---|---|
| 檔案 size = 0 | Set Variable 在 API call 之後 |
把 Set Variable 移到 Get Contents of URL 前面 |
| 422 content is not valid Base64 | Repeat with each item 接的是 Formatted Date 而非圖片 |
改成 Shortcut Input |
| 422 sha wasn’t supplied | 兩張圖同一秒產生相同檔名,第二張被視為更新操作 | 檔名加上 Repeat Index |
| 多張圖 base64 合併 | Shortcut Input 是陣列,Encode 會把所有內容合併 |
用 Repeat with each item 逐張處理 |
- IPHONE setting 20260413_152101_1.jpg 20260413_152101_2.jpg 20260413_152101_3.jpg
📅 2026-XX-XX(XXX)
📚 Topic
- (主題)
📝 Practice
- (說明)
🖼️ Photos
IMG_XXXX.jpeg
💬 Notes
(備註)