interface FileConverter (View source)

Interface providing the public API for file converters, so that FileConverterManager can find and use suitable converters.

Methods

public
bool
supportsConversion(string $fromExtension, string $toExtension, array $options = [])

Checks whether this converter supports a conversion from one file type to another.

public
convert(File $from, string $toExtension, array $options = [])

Converts the given DBFile instance to another file type.

Details

bool supportsConversion(string $fromExtension, string $toExtension, array $options = [])

Checks whether this converter supports a conversion from one file type to another.

Parameters

string $fromExtension

The file extension you want to convert from - e.g. "jpg".

string $toExtension

The file extension you want to convert to - e.g. "webp".

array $options

Any options defined for this converter which should apply to the conversion. Note that if the converter supports this conversion generally but doesn't support these options, this method will return false.

Return Value

bool

DBFile convert(File $from, string $toExtension, array $options = [])

Converts the given DBFile instance to another file type.

Parameters

File $from
string $toExtension

The file extension you want to convert to - e.g. "webp".

array $options

Any options defined for this converter which should apply to the conversion.

Return Value

DBFile

Exceptions

FileConverterException