Bỏ qua để đến nội dung
ViGrise Platform

Local Filesystem

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

The local filesystem source allows PreviewProxy to serve and transform images stored on the same machine (or a mounted volume). This is useful in containerised deployments where images are available on a shared volume, or in development environments where you want to serve local files.

The local source is disabled by default. Set PP_LOCAL_ENABLED=true and provide a base directory to activate it.

VariableDescription
PP_LOCAL_ENABLEDSet to true to enable the local filesystem source.
PP_LOCAL_BASE_DIRAbsolute path to the root directory from which images will be served.
PP_LOCAL_ENABLED=true
PP_LOCAL_BASE_DIR=/data/images

To request a local image, use the local: scheme in the image URL portion of the path. The path after local:/ is treated as relative to PP_LOCAL_BASE_DIR:

/format=webp/local:/products/photo.jpg

The path in the request is joined with PP_LOCAL_BASE_DIR to produce the final file path on disk.

Example: With PP_LOCAL_BASE_DIR=/data/images:

Request PathFile Served
local:/products/photo.jpg/data/images/products/photo.jpg
local:/banner.png/data/images/banner.png
local:/2024/uploads/avatar.jpg/data/images/2024/uploads/avatar.jpg

Full request example:

/format=webp/local:/products/photo.jpg

This protection applies regardless of how the path is encoded in the request URL.