final class ImageUploadOptions (View source)

Carries image upload policy with catalog-backed extension validation.

Methods

__construct(string $targetDirectory, string $targetRelativeDirectory, int $maxBytes = 5242880, array $allowedExtensions = ['jpg', 'jpeg', 'png', 'webp'], bool $reencode = true, int|null $minWidth = null, int|null $maxWidth = null, int|null $minHeight = null, int|null $maxHeight = null, UploadVisibility $visibility = UploadVisibility::Public, array $allowedRisks = [])

Creates an immutable image policy that applies catalog MIME matching before image decoding.

string

Provides the absolute directory where a validated image is published.

string
string

Provides the directory retained relative to either the public root or private writable root.

string
int

Provides the positive server-enforced source-payload limit in bytes.

int
array

Provides normalized filename suffixes that may proceed to catalog MIME matching.

array
bool

Indicates whether validated source bytes are re-encoded before publication.

bool
int|null

Provides the optional inclusive lower bound for decoded source-image width.

int|null
int|null

Provides the optional inclusive upper bound for decoded source-image width.

int|null
int|null

Provides the optional inclusive lower bound for decoded source-image height.

int|null
int|null

Provides the optional inclusive upper bound for decoded source-image height.

int|null
UploadVisibility

Identifies whether the validated image is published publicly or retained in private writable storage.

UploadVisibility
array

Provides the non-passive risk categories explicitly authorized for private storage.

array

Details

__construct

__construct(string $targetDirectory, string $targetRelativeDirectory, int $maxBytes = 5242880, array $allowedExtensions = ['jpg', 'jpeg', 'png', 'webp'], bool $reencode = true, int|null $minWidth = null, int|null $maxWidth = null, int|null $minHeight = null, int|null $maxHeight = null, UploadVisibility $visibility = UploadVisibility::Public, array $allowedRisks = [])

Creates an immutable image policy that applies catalog MIME matching before image decoding.

Parameters

string $targetDirectory
string $targetRelativeDirectory
int $maxBytes
array $allowedExtensions

Explicit normalized filename suffixes permitted by this upload operation

bool $reencode
int|null $minWidth
int|null $maxWidth
int|null $minHeight
int|null $maxHeight
UploadVisibility $visibility
array $allowedRisks

Non-passive categories explicitly authorized for private storage

targetDirectory

string targetDirectory()

Provides the absolute directory where a validated image is published.

Return Value

string

targetRelativeDirectory

string targetRelativeDirectory()

Provides the directory retained relative to either the public root or private writable root.

Return Value

string

maxBytes

int maxBytes()

Provides the positive server-enforced source-payload limit in bytes.

Return Value

int

allowedExtensions

array allowedExtensions()

Provides normalized filename suffixes that may proceed to catalog MIME matching.

Return Value

array

reencode

bool reencode()

Indicates whether validated source bytes are re-encoded before publication.

Return Value

bool

minWidth

int|null minWidth()

Provides the optional inclusive lower bound for decoded source-image width.

Return Value

int|null

maxWidth

int|null maxWidth()

Provides the optional inclusive upper bound for decoded source-image width.

Return Value

int|null

minHeight

int|null minHeight()

Provides the optional inclusive lower bound for decoded source-image height.

Return Value

int|null

maxHeight

int|null maxHeight()

Provides the optional inclusive upper bound for decoded source-image height.

Return Value

int|null

visibility

UploadVisibility visibility()

Identifies whether the validated image is published publicly or retained in private writable storage.

Return Value

UploadVisibility

allowedRisks

array allowedRisks()

Provides the non-passive risk categories explicitly authorized for private storage.

Return Value

array