TempFile

Methods Summary
public
# __construct( string $tempDir , array $mediaTypeMap , Omeka\File\Store\StoreInterface $store , Omeka\File\ThumbnailManager $thumbnailManager )
public
# setTempPath( string $tempPath )
Set the path to the temporary file. Typically needed only when the temporary file already exists on the server.
public
# getTempPath( )
Get the path to the temporary file.
public
# getSourceName( )
Get the name/path of the source file.
public
# setSourceName( string $sourceName )
Set the name/path of the source file.
public
# getStorageId( )
Get the storage ID. The storage ID is the base name (without extension) of the persistently stored file.
public
# setStorageId( string $storageId )
Set the storage ID
public
# store( string $prefix , null|string $extension = NULL, null|string $tempPath = NULL )
Store a file.
public
# storeOriginal( )
Store this as an "original" file.
public
# storeAsset( )
Store this as an "asset" file.
public
# storeThumbnails( )
Create and store thumbnail derivatives of this file.
public
# getMediaType( )
Get the Internet media type of the file.

uses

finfo
public
# getExtension( )
Get the filename extension for the original file. Heuristically determines whether the passed file has an extension. The source name must contain at least one dot, the source name must not end with a dot, and the extension must not be over 12 characters. Returns the extension if found. Returns a "best guess" extension if the media type is known but the original extension is not found. Returns null if the file has no source name or the file has no extension and the media type cannot be mapped to an extension.
public
# getSha256( )
Get the SHA-256 checksum of the file.

uses

hash_file
public
# delete( )
Delete this temporary file. Always delete a temporary file after all work has been done. Otherwise the file will remain in the temporary directory.
Constants Summary
public array MEDIA_TYPE_ALIASES
Map of nonstandard-to-standard media types.
# array ( 'application/x-ogg' => 'application/ogg', 'text/rtf' => 'application/rtf', 'audio/mid' => 'audio/midi', 'audio/x-midi' => 'audio/midi', 'audio/mp3' => 'audio/mpeg', 'audio/mpeg3' => 'audio/mpeg', 'audio/x-mp3' => 'audio/mpeg', 'audio/x-mpeg' => 'audio/mpeg', 'audio/x-mpeg3' => 'audio/mpeg', 'audio/x-mpegaudio' => 'audio/mpeg', 'audio/x-mpg' => 'audio/mpeg', 'audio/x-ogg' => 'audio/ogg', 'audio/aac' => 'audio/x-aac', 'audio/aiff' => 'audio/x-aiff', 'audio/x-wma' => 'audio/x-ms-wma', 'audio/wma' => 'audio/x-ms-wma', 'audio/x-mp4' => 'audio/mp4', 'audio/x-m4a' => 'audio/mp4', 'audio/wav' => 'audio/x-wav', 'image/x-ms-bmp' => 'image/bmp', 'image/icon' => 'image/x-icon', 'video/x-m4v' => 'video/mp4', 'video/asf' => 'video/x-ms-asf', 'video/wmv' => 'video/x-ms-wmv', 'video/avi' => 'video/x-msvideo', 'video/msvideo' => 'video/x-msvideo', )
Properties Summary
protected Omeka\File\Store\StoreInterface $store
# NULL
protected Omeka\File\ThumbnailManager $thumbnailManager
# NULL
protected string $tempDir
# NULL
protected string $tempPath
# NULL
protected array $mediaTypeMap
# NULL
protected string $sourceName
# NULL
protected string $storageId
# NULL
protected string $mediaType
# NULL
protected string $extension
# NULL