1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2026-04-23 19:41:06 +02:00
Files

34 lines
890 B
Go
Raw Permalink Normal View History

2025-09-23 15:55:04 +02:00
package processing
import (
"github.com/imgproxy/imgproxy/v3/auximageprovider"
2025-10-03 16:48:37 +02:00
"github.com/imgproxy/imgproxy/v3/processing/svg"
"github.com/imgproxy/imgproxy/v3/security"
2025-09-23 15:55:04 +02:00
)
// Processor is responsible for processing images according to the given configuration.
type Processor struct {
config *Config
securityChecker *security.Checker
2025-09-23 15:55:04 +02:00
watermarkProvider auximageprovider.Provider
2025-10-03 16:48:37 +02:00
svg *svg.Processor
2025-09-23 15:55:04 +02:00
}
// New creates a new Processor instance with the given configuration and watermark provider
func New(
config *Config,
securityChecker *security.Checker,
watermark auximageprovider.Provider,
) (*Processor, error) {
2025-09-23 15:55:04 +02:00
if err := config.Validate(); err != nil {
return nil, err
}
return &Processor{
config: config,
securityChecker: securityChecker,
2025-09-23 15:55:04 +02:00
watermarkProvider: watermark,
2025-10-03 16:48:37 +02:00
svg: svg.New(&config.Svg),
2025-09-23 15:55:04 +02:00
}, nil
}