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
累计下载
2,808
星标
1
全站排名
#3,864
全站前 77% · 「设计创意」前 73%
平台累计安装累计下载星标评论
ClawHub ↗872,5751-
SkillHub ↗1952,8081—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

本地图片交由读取工具显示,远程图片先暂存下载。路径应限定在授权目录,并检查远程文件类型与大小;临时文件应用安全文件API清理,避免拼接路径执行shell命令。

资料发布于 2026-10-27

可以用来做什么

  • 查看授权图片

什么时候用

  • 需要查看授权图片时。

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

显示这张授权本地图片,若路径超出工作目录则说明。

月度数据趋势

累计下载2,808
1,9052,3902,8752026-03 · 累计下载 1,9722026-05 · 累计下载 2,2182026-07 · 累计下载 2,4792026-08 · 累计下载 2,5412026-09 · 累计下载 2,80826-0326-09
星标1
0122026-03 · 星标 12026-05 · 星标 12026-07 · 星标 12026-08 · 星标 12026-09 · 星标 126-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-092,808—1
2026-082,541+2.5%1
2026-072,479—1
2026-052,218—1
2026-031,972—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),按月更新。口径说明见数据方法。