Omeka_File_Derivative_Creator

Package: File\Derivative

class Omeka_File_Derivative_Creator

Create derivative images for a file in Omeka.

create($sourcePath, $derivFilename, $mimeType)

Create all the derivatives requested with addDerivative().

Parameters:
  • $sourcePath (string) –
  • $derivFilename (string) –
  • $mimeType (string) –
Returns:

bool

addDerivative($storageType, $size)

Add a derivative image to be created.

Parameters:
  • $storageType (string) –
  • $size (int) – The size constraint for the image, meaning it will have that maximum width or height, depending on whether the image is landscape or portrait.
setStrategy(Omeka_File_Derivative_StrategyInterface $strategy)

Set the strategy for creating derivatives.

Parameters:
getStrategy()

Get the strategy for creating derivatives.

Returns:Omeka_File_Derivative_StrategyInterface
setTypeBlacklist($blacklist)

Set the type blacklist.

Parameters:
  • $blacklist (array|null) – An array of mime types to blacklist.
setTypeWhitelist($whitelist)

Set the type whitelist.

Parameters:
  • $whitelist (array|null) – An array of mime types to whitelist.
_isDerivable($filePath, $mimeType)

Returns whether Omeka can make derivatives of the given file.

The file must be readable and pass the mime whitelist/blacklist.

Parameters:
  • $filePath (string) –
  • $mimeType (string) –
Returns:

bool

_passesBlacklist($mimeType)

Return whether the given type is allowed by the blacklist.

If no blacklist is specified all types will pass.

Parameters:
  • $mimeType (string) –
Returns:

bool

_passesWhitelist($mimeType)

Return whether the given type is allowed by the whitelist.

If no whitelist is specified all types will pass, but an empty whitelist will reject all types.

Parameters:
  • $mimeType (string) –
Returns:

bool