final class ImageUploadValidator (View source)

internal  UploadService supplies only sealed private snapshots and publishes only after this validator succeeds.
 

Adds image decoding, detected-image MIME agreement, and dimension checks to the generic upload boundary.

Methods

__construct(FileUploadValidator $fileValidator, TranslatorInterface $translator, ImageProcessorInterface $imageProcessor)

Extends the generic extension and MIME boundary with image-specific content validation.

Validates an image snapshot and returns its detected MIME together with completely decoded pixels.

validateGenerated(StagedUpload $file, ImageFormat $expectedFormat, DecodedImage $source)

Fully decodes framework-generated output and verifies that encoding preserved its format and dimensions.

Details

__construct

__construct(FileUploadValidator $fileValidator, TranslatorInterface $translator, ImageProcessorInterface $imageProcessor)

Extends the generic extension and MIME boundary with image-specific content validation.

Parameters

FileUploadValidator $fileValidator
TranslatorInterface $translator
ImageProcessorInterface $imageProcessor

validate

Validates an image snapshot and returns its detected MIME together with completely decoded pixels.

The detected MIME must agree with both MimeTypeCatalog and decoded image metadata.

Parameters

StagedUpload $file
ImageUploadOptions $options

Return Value

ValidatedImageUpload

Exceptions

UploadValidationException

validateGenerated

DecodedImage validateGenerated(StagedUpload $file, ImageFormat $expectedFormat, DecodedImage $source)

Fully decodes framework-generated output and verifies that encoding preserved its format and dimensions.

Parameters

StagedUpload $file
ImageFormat $expectedFormat
DecodedImage $source

Return Value

DecodedImage

Exceptions

UploadValidationException