{"skill":{"slug":"smart-image-loader","displayName":"smart-image-loader","summary":"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.","description":"---\nname: smart-image-loader\ndescription: 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.\n---\n\n# Smart Image Loader\n\n## Quick Start\n\nWhen a user asks to display an image:\n\n1. **Check if input is a URL or local path**\n   - URLs start with `http://` or `https://`\n   - Local paths are file paths in the workspace\n\n2. **For URLs:**\n   - Download the image to a temporary location using the Python script\n   - Use `read` tool to display the image\n   - Clean up the temporary file afterward\n\n3. **For local files:**\n   - Verify the file exists (relative to workspace or absolute path)\n   - Use `read` tool directly to display the image\n\n## Usage Examples\n\n**User says:** \"Show me this image: https://example.com/photo.jpg\"\n\n1. Run: `python3 scripts/smart_image_loader.py https://example.com/photo.jpg`\n2. Script downloads to temp: `/tmp/dir/photo.jpg`\n3. Use `read` tool on: `/tmp/dir/photo.jpg`\n4. Clean up: Delete the temp file\n\n**User says:** \"Display ./images/logo.png\"\n\n1. Run: `python3 scripts/smart_image_loader.py ./images/logo.png`\n2. Script verifies file exists\n3. Use `read` tool on: `/home/node/clawd/images/logo.png` (absolute path)\n\n## Script Usage\n\n```bash\npython3 scripts/smart_image_loader.py <image_path_or_url>\n```\n\n### Arguments\n\n| Argument | Description |\n|----------|-------------|\n| `image_path_or_url` | Either a local file path (relative or absolute) or a URL |\n\n### Output Format\n\nThe script returns a JSON-like output with:\n- `Status`: SUCCESS or FAILED\n- `Type`: url or local\n- `File Path`: Local path for the `read` tool\n- `Message`: Status description\n- `Cleanup Needed`: true if temp file should be deleted\n\n### Examples\n\n```bash\n# URL example\npython3 scripts/smart_image_loader.py https://example.com/image.jpg\n# Output: Downloads to /tmp/xyz/image.jpg, use read tool on that path\n\n# Local file example (relative)\npython3 scripts/smart_image_loader.py ./photos/vacation.jpg\n# Output: File found at /home/node/clawd/photos/vacation.jpg\n\n# Local file example (absolute)\npython3 scripts/smart_image_loader.py /home/node/clawd/downloads/graphic.png\n# Output: File found at /home/node/clawd/downloads/graphic.png\n```\n\n## Workflow Decision Tree\n\n```\nUser asks to display an image\n         |\n         v\n    Is it a URL? (http:// or https://)\n         |\n    +----+---------------------------+\n    |                                 |\n   YES                               NO\n    |                                 |\n    v                                 v\nDownload to temp              Does file exist?\n    |                                 |\n    v                          +-----+-----+\nUse read tool                 |           |\n    |                        YES          NO\n    v                              |\nCleanup temp file              v\n                           Use read tool\n                               |\n                               v\n                          Done (no cleanup)\n```\n\n## Cleanup Guidelines\n\n- **URL downloads**: Always clean up temporary files after displaying\n- **Local files**: No cleanup needed (files remain in workspace)\n- Use `exec` with `rm <file_path>` for cleanup\n\n## Image Formats Supported\n\n- JPEG (.jpg, .jpeg)\n- PNG (.png)\n- GIF (.gif)\n- WebP (.webp)\n- BMP (.bmp)\n\n## Error Handling\n\n| Scenario | Action |\n|----------|--------|\n| URL download fails | Report error to user |\n| Local file not found | Report error to user |\n| Invalid input | Show usage instructions |","topics":["Local Files"],"tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":2306,"installsAllTime":87,"installsCurrent":5,"stars":1,"versions":1},"createdAt":1770108948185,"updatedAt":1778486000320},"latestVersion":{"version":"1.0.0","createdAt":1770108948185,"changelog":"Initial release of smart-image-loader.\n\n- Supports displaying images from both URLs and local files.\n- Automatically downloads images from URLs to a temporary location and cleans up after display.\n- Verifies existence of local image files and displays them directly.\n- Outputs a structured JSON-like response for integration with the read tool.\n- Includes detailed usage instructions, workflow, and error handling guidelines.","license":null},"metadata":null,"owner":{"handle":"tingwei1123","userId":"s175gwjnxg2w8z26gbvyq523zs885dv3","displayName":"tingwei1123","image":"https://avatars.githubusercontent.com/u/112472562?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779943608292}}