tingwei1123

smart-image-loader

設計創意v1.0.0
作者:tingwei1123更新於 2026-05-11@clawhub_tingwei1123/smart-image-loader
圖片編輯視覺素材#Local Files

據 AlphaMoat 統計,截至 2026-09,smart-image-loader 累計下載 2,808 次、獲 1 個星標,在全部 5,078 個 AI 技能中排名第 3,864 位,在「設計創意」分類(512 個)中排名第 370 位。

累計安裝
195
累計下載
2808
星標
1
全站排名
#3,864
全站前 77% · 「設計創意」前 73%
平台累計安裝累計下載星標評論
ClawHub ↗8725751-
SkillHub ↗19528081—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

本機圖片交由讀取工具顯示,遠端圖片先暫存下載。路徑應限定在授權目錄,並檢查遠端檔案類型與大小;暫存檔應用安全檔案API清理,避免拼接路徑執行shell命令。

資料釋出於 2026-10-27

可以用來做什麼

  • 查看授權圖片

什麼時候用

  • 需要查看授權圖片時。

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

顯示這張授權本機圖片,若路徑超出工作目錄則說明。

月度資料趨勢

累計下載2808
1905239028752026-03 · 累計下載 19722026-05 · 累計下載 22182026-07 · 累計下載 24792026-08 · 累計下載 25412026-09 · 累計下載 280826-0326-09
星標1
0122026-03 · 星標 12026-05 · 星標 12026-07 · 星標 12026-08 · 星標 12026-09 · 星標 126-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-092808—1
2026-082541+2.5%1
2026-072479—1
2026-052218—1
2026-031972—1

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

3.6 KB · ClawHub v1.0.0
---
name: smart-image-loader
description: Smart image loader that handles both URLs and local files, automatically downloads URLs to temporary locations, and displays images using the read tool. Use when a user wants to view or display an image, whether it's a web URL or a file in the workspace.
---

# Smart Image Loader

## Quick Start

When a user asks to display an image:
展開全部(共 123 行)

1. **Check if input is a URL or local path**
   - URLs start with `http://` or `https://`
   - Local paths are file paths in the workspace

2. **For URLs:**
   - Download the image to a temporary location using the Python script
   - Use `read` tool to display the image
   - Clean up the temporary file afterward

3. **For local files:**
   - Verify the file exists (relative to workspace or absolute path)
   - Use `read` tool directly to display the image

## Usage Examples

**User says:** "Show me this image: https://example.com/photo.jpg"

1. Run: `python3 scripts/smart_image_loader.py https://example.com/photo.jpg`
2. Script downloads to temp: `/tmp/dir/photo.jpg`
3. Use `read` tool on: `/tmp/dir/photo.jpg`
4. Clean up: Delete the temp file

**User says:** "Display ./images/logo.png"

1. Run: `python3 scripts/smart_image_loader.py ./images/logo.png`
2. Script verifies file exists
3. Use `read` tool on: `/home/node/clawd/images/logo.png` (absolute path)

## Script Usage

```bash
python3 scripts/smart_image_loader.py <image_path_or_url>
```

### Arguments

| Argument | Description |
|----------|-------------|
| `image_path_or_url` | Either a local file path (relative or absolute) or a URL |

### Output Format

The script returns a JSON-like output with:
- `Status`: SUCCESS or FAILED
- `Type`: url or local
- `File Path`: Local path for the `read` tool
- `Message`: Status description
- `Cleanup Needed`: true if temp file should be deleted

### Examples

```bash
# URL example
python3 scripts/smart_image_loader.py https://example.com/image.jpg
# Output: Downloads to /tmp/xyz/image.jpg, use read tool on that path

# Local file example (relative)
python3 scripts/smart_image_loader.py ./photos/vacation.jpg
# Output: File found at /home/node/clawd/photos/vacation.jpg

# Local file example (absolute)
python3 scripts/smart_image_loader.py /home/node/clawd/downloads/graphic.png
# Output: File found at /home/node/clawd/downloads/graphic.png
```

## Workflow Decision Tree

```
User asks to display an image
         |
         v
    Is it a URL? (http:// or https://)
         |
    +----+---------------------------+
    |                                 |
   YES                               NO
    |                                 |
    v                                 v
Download to temp              Does file exist?
    |                                 |
    v                          +-----+-----+
Use read tool                 |           |
    |                        YES          NO
    v                              |
Cleanup temp file              v
                           Use read tool
                               |
                               v
                          Done (no cleanup)
```

## Cleanup Guidelines

- **URL downloads**: Always clean up temporary files after displaying
- **Local files**: No cleanup needed (files remain in workspace)
- Use `exec` with `rm <file_path>` for cleanup

## Image Formats Supported

- JPEG (.jpg, .jpeg)
- PNG (.png)
- GIF (.gif)
- WebP (.webp)
- BMP (.bmp)

## Error Handling

| Scenario | Action |
|----------|--------|
| URL download fails | Report error to user |
| Local file not found | Report error to user |
| Invalid input | Show usage instructions |

「設計創意」分類下的熱門技能

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。