ui/netimage
Network pictures, optional modules. After the introduction, the Source, Markdown images and image disk cache of Image, Avatar, Attachment can load the http:// and https:// addresses.
import _ "github.com/dyike/keel/ui/netimage"
- Why it is packaged separately: It uses
net/http, and together with encryption libraries such as TLS, it is about 4 MB. Applications that only display local images do not need to bring it. When not imported, the local path,file://and data URL work as usual, the network address returnscore.ErrNoImageFetcher, and the error message indicates the package to be imported. - Dependencies:
ui/core(implementscore.ImageFetcherandcore.SetImageFetcherininit) and the standard librarynet/http. netimage.Clientis the HTTP client used. The default ishttp.DefaultClient. It can be changed to a client with proxy, timeout or authentication before the first request.
To use another network stack, implement core.ImageFetcher and call core.SetImageFetcher.