Download images from URLs
A simple and efficient image downloader Dify plugin that can download images from URLs and return them as blobs.
This plugin allows you to easily download images by providing image URLs.
Basic usage:
Real-world application scenario:
As shown in the image below, LLM outputs Markdown-formatted image links in responses, but due to CSP restrictions, these external images cannot be displayed directly. You can use the following code to extract image URLs from LLM responses, then download and display images through this plugin.
The above code can be used as a Python runtime node in Dify Workflow. After extracting the image URL, pass it to the image downloader plugin to solve CSP restriction issues.
[Image blocked: Usage Example]
This plugin solves the Content Security Policy (CSP) restriction issue in Dify cloud version (udify.app). When AI needs to display images from external domains, these images cannot be displayed by default due to CSP restrictions. This plugin bypasses CSP limitations by first downloading the image and then returning it via blob, allowing external images to display normally.
When not using this plugin, attempting to load external images will encounter CSP errors similar to the following:
Related issue: Dify Issue #9878
If you encounter any problems or have suggestions, please submit an issue on the GitHub repository.