netimage

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 4 Imported by: 0

README

ui/netimage

English | 简体中文

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 returns core.ErrNoImageFetcher, and the error message indicates the package to be imported.
  • Dependencies: ui/core (implements core.ImageFetcher and core.SetImageFetcher in init) and the standard library net/http.
  • netimage.Client is the HTTP client used. The default is http.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.

Documentation

Overview

Package netimage lets Keel load images from http and https URLs. Import it for its side effect where the app shows network images:

import _ "github.com/dyike/keel/ui/netimage"

It is separate because net/http and TLS add about 4 MB to a binary that may never fetch an image.

Index

Constants

This section is empty.

Variables

Client is the HTTP client used for images, http.DefaultClient unless set before the first request.

Functions

func Fetch

func Fetch(ctx context.Context, url string, header map[string]string) (int, map[string]string, io.ReadCloser, error)

Fetch is the core.ImageFetcher this package installs.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL