mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-11 04:32:29 +02:00
IMG-49: Get rid of global watermark image and fetcher (#1515)
* Get rid of global watermark image * imagedata.Factory, removed global Fetcher
This commit is contained in:
@@ -3,6 +3,7 @@ package processing
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/imgproxy/imgproxy/v3/auximageprovider"
|
||||
"github.com/imgproxy/imgproxy/v3/imagedata"
|
||||
"github.com/imgproxy/imgproxy/v3/imagetype"
|
||||
"github.com/imgproxy/imgproxy/v3/options"
|
||||
@@ -15,6 +16,9 @@ type pipelineContext struct {
|
||||
|
||||
imgtype imagetype.Type
|
||||
|
||||
// The watermark image provider, if any watermarking is to be done.
|
||||
watermarkProvider auximageprovider.Provider
|
||||
|
||||
trimmed bool
|
||||
|
||||
srcWidth int
|
||||
@@ -67,7 +71,13 @@ type pipelineContext struct {
|
||||
type pipelineStep func(pctx *pipelineContext, img *vips.Image, po *options.ProcessingOptions, imgdata imagedata.ImageData) error
|
||||
type pipeline []pipelineStep
|
||||
|
||||
func (p pipeline) Run(ctx context.Context, img *vips.Image, po *options.ProcessingOptions, imgdata imagedata.ImageData) error {
|
||||
func (p pipeline) Run(
|
||||
ctx context.Context,
|
||||
img *vips.Image,
|
||||
po *options.ProcessingOptions,
|
||||
imgdata imagedata.ImageData,
|
||||
watermark auximageprovider.Provider,
|
||||
) error {
|
||||
pctx := pipelineContext{
|
||||
ctx: ctx,
|
||||
|
||||
@@ -77,7 +87,8 @@ func (p pipeline) Run(ctx context.Context, img *vips.Image, po *options.Processi
|
||||
dprScale: 1.0,
|
||||
vectorBaseScale: 1.0,
|
||||
|
||||
cropGravity: po.Crop.Gravity,
|
||||
cropGravity: po.Crop.Gravity,
|
||||
watermarkProvider: watermark,
|
||||
}
|
||||
|
||||
if pctx.cropGravity.Type == options.GravityUnknown {
|
||||
|
Reference in New Issue
Block a user