File

class File

Package: Record

A file and its metadata.

property item_id
property order
property filename
property original_filename
property size
property authentication
property mime_type
property type_os
property has_derivative_image
property added
property modified
property stored
property metadata
property _pathsByType
getProperty(string $property)

Get a property or special value of this record.

Parameters:
  • $property (string) –
Returns:

mixed

_initializeMixins()

Initialize mixins.

filterPostData(array $post)

Unset immutable properties from $_POST.

Parameters:
  • $post (array) –
Returns:

array

beforeSave(array $args)

Do something before saving this record.

Parameters:
  • $args (array) –
afterSave(array $args)

Do something after saving this record.

Parameters:
  • $args (array) –
getItem()

Retrieve the parent item of this record.

Returns:Item
getPath(string $type = original)

Retrieve a system path for this file.

Parameters:
  • $type (string) –
Returns:

string

getWebPath(string $type = original)

Retrieve a web path for this file.

Parameters:
  • $type (string) –
Returns:

string

getDerivativeFilename()

Retrieve the derivative filename.

Returns:string
hasThumbnail()

Determine whether this record has a thumbnail image.

Returns:bool
hasFullsize()

Determine whether this record has a fullsize image.

Returns:bool
getExtension()

Get the original file’s extension.

Returns:string
setDefaults($filepath, $options = Array)

Set the default values that will be stored for this record in the ‘files’ table.

Parameters:
  • $filepath (unknown) –
  • $options (unknown) –
Returns:

void

unlinkFile()

Unlink the file and file derivatives belonging to this record.

_delete()

Perform any further deletion when deleting this record.

createDerivatives()

Create derivatives of the original file.

extractMetadata()

Extract ID3 metadata associated with the file.

Returns:boolean
_getId3()

Pull down the file’s extra metadata via getID3 library.

Returns:getID3
storeFiles()

Store files belonging to this record.

getStoragePath(string $type = fullsize)

Get the storage path.

Parameters:
  • $type (string) –
Returns:

string

setStorage(Omeka_Storage $storage)

Set the storage object.

Parameters:
getStorage()

Get the storage object.

Returns:Omeka_Storage
getResourceId()

Get the ACL resource ID for the record.

File records are ‘Files’ resources.

Returns:string
isOwnedBy(User $user)

Return whether this file is owned by the given user.

Proxies to the Item’s isOwnedBy.

Parameters:
Returns:

boolean