processor.go 730 B

1234567891011121314151617181920212223242526
  1. package processing
  2. import (
  3. "github.com/imgproxy/imgproxy/v3/auximageprovider"
  4. "github.com/imgproxy/imgproxy/v3/processing/svg"
  5. )
  6. // Processor is responsible for processing images according to the given configuration.
  7. type Processor struct {
  8. config *Config
  9. watermarkProvider auximageprovider.Provider
  10. svg *svg.Processor
  11. }
  12. // New creates a new Processor instance with the given configuration and watermark provider
  13. func New(config *Config, watermark auximageprovider.Provider) (*Processor, error) {
  14. if err := config.Validate(); err != nil {
  15. return nil, err
  16. }
  17. return &Processor{
  18. config: config,
  19. watermarkProvider: watermark,
  20. svg: svg.New(&config.Svg),
  21. }, nil
  22. }