返回顶部
s

smart-image-loader智能图片加载器

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.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,906
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

smart-image-loader

智能图片加载器

快速开始

当用户要求显示图片时:

  1. 1. 检查输入是URL还是本地路径
- URL以http://或https://开头 - 本地路径是工作区中的文件路径
  1. 2. 对于URL:
- 使用Python脚本将图片下载到临时位置 - 使用read工具显示图片 - 之后清理临时文件
  1. 3. 对于本地文件:
- 验证文件是否存在(相对于工作区或绝对路径) - 直接使用read工具显示图片

使用示例

用户说: 给我看这张图片:https://example.com/photo.jpg

  1. 1. 运行:python3 scripts/smartimageloader.py https://example.com/photo.jpg
  2. 脚本下载到临时目录:/tmp/dir/photo.jpg
  3. 在/tmp/dir/photo.jpg上使用read工具
  4. 清理:删除临时文件

用户说: 显示./images/logo.png

  1. 1. 运行:python3 scripts/smartimageloader.py ./images/logo.png
  2. 脚本验证文件是否存在
  3. 在/home/node/clawd/images/logo.png(绝对路径)上使用read工具

脚本使用

bash
python3 scripts/smartimageloader.py <图片路径或URL>

参数

参数描述
图片路径或URL本地文件路径(相对或绝对)或URL

输出格式

脚本返回类似JSON的输出,包含:

  • - Status:SUCCESS或FAILED
  • Type:url或local
  • File Path:供read工具使用的本地路径
  • Message:状态描述
  • Cleanup Needed:如果需要删除临时文件则为true

示例

bash

URL示例


python3 scripts/smartimageloader.py https://example.com/image.jpg

输出:下载到/tmp/xyz/image.jpg,在该路径上使用read工具

本地文件示例(相对路径)

python3 scripts/smartimageloader.py ./photos/vacation.jpg

输出:文件位于/home/node/clawd/photos/vacation.jpg

本地文件示例(绝对路径)

python3 scripts/smartimageloader.py /home/node/clawd/downloads/graphic.png

输出:文件位于/home/node/clawd/downloads/graphic.png

工作流程决策树

用户要求显示图片
|
v
是否为URL?(http://或https://)
|
+----+---------------------------+
| |
是 否
| |
v v
下载到临时目录 文件是否存在?
| |
v +-----+-----+
使用read工具 | |
| 是 否
v |
清理临时文件 v
使用read工具
|
v
完成(无需清理)

清理指南

  • - URL下载:显示后始终清理临时文件
  • 本地文件:无需清理(文件保留在工作区中)
  • 使用exec配合rm <文件路径>进行清理

支持的图片格式

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

错误处理

场景操作
URL下载失败向用户报告错误
本地文件未找到
向用户报告错误 | | 无效输入 | 显示使用说明 |

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 smart-image-loader-1776368185 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 smart-image-loader-1776368185 技能

通过命令行安装

skillhub install smart-image-loader-1776368185

下载

⬇ 下载 smart-image-loader v1.0.0(免费)

文件大小: 3.62 KB | 发布时间: 2026-4-17 14:10

v1.0.0 最新 2026-4-17 14:10
Initial release of smart-image-loader.

- Supports displaying images from both URLs and local files.
- Automatically downloads images from URLs to a temporary location and cleans up after display.
- Verifies existence of local image files and displays them directly.
- Outputs a structured JSON-like response for integration with the read tool.
- Includes detailed usage instructions, workflow, and error handling guidelines.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部