Skip to content

Kirby 4.2.0

$image->sanitizeContents()

Sanitizes the file contents depending on the file type by overwriting the file with the sanitized version

$image->sanitizeContents(string|bool $typeLazy = false): void

Parameters

Name Type Default Description
$typeLazy string|bool false Explicit sane handler type string,
true for lazy autodetection or
false for normal autodetection

Exceptions

Type Description
Kirby\Exception\InvalidArgumentException If the file didn't pass validation
Kirby\Exception\LogicException If more than one handler applies
Kirby\Exception\NotFoundException If the handler was not found
Kirby\Exception\Exception On other errors

Parent class

Kirby\Image\Image inherited from Kirby\Filesystem\File