File

Package: Record

class File

extends Omeka_Record_AbstractRecord

implements Zend_Acl_Resource_Interface

A file and its metadata.

constant File::DISABLE_DEFAULT_VALIDATION_OPTION

Option name for whether the file validation is disabled.

constant File::DERIVATIVE_EXT

File extension for all image derivatives.

property File::$item_id

int

ID of the Item this File belongs to.

property File::$order

int

Relative order of this File within the parent Item.

property File::$filename

string

Current filename, as stored.

property File::$original_filename

string

Original filename, as uploaded.

property File::$size

int

Size of the file, in bytes.

property File::$authentication

string

MD5 hash of the file.

property File::$mime_type

string

MIME type of the file.

property File::$type_os

string

Longer description of the file’s type.

property File::$has_derivative_image

int

Whether the file has derivative images.

property File::$added

string

Date the file was added.

property File::$modified

string

Date the file was last modified.

property File::$stored

int

Whether the file has been moved to storage.

property File::$metadata

array

Embedded metadata from the file.

File::getProperty($property)

Get a property or special value of this record.

Parameters:
  • $property (string) –
Returns:

mixed

File::_initializeMixins()

Initialize the mixins.

File::filterPostData($post)

Unset immutable properties from $_POST.

Parameters:
  • $post (array) –
Returns:

array

File::beforeSave($args)

Before-save hook.

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

After-save hook.

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

Get the Item this file belongs to.

Returns:Item
File::getPath($type = 'original')

Get a system path for this file.

Local paths are only available before the file is stored.

Parameters:
  • $type (string) –
Returns:

string

File::getWebPath($type = 'original')

Get a web path for this file.

Parameters:
  • $type (string) –
Returns:

string

File::getDerivativeFilename()

Get the filename for this file’s derivative images.

Returns:string
File::hasThumbnail()

Determine whether this file has a thumbnail image.

Returns:bool
File::hasFullsize()

Determine whether this record has a fullsize image.

This is an alias for hasThumbnail().

Returns:bool
File::getExtension()

Get the original file’s extension.

Returns:string
File::setDefaults($filepath, $options = array())

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

Parameters:
  • $filepath
  • $options
File::unlinkFile()

Unlink the file and file derivatives belonging to this record.

File::_delete()

Perform any further deletion when deleting this record.

File::createDerivatives()

Create derivatives of the original file.

File::extractMetadata()

Extract ID3 metadata associated with the file.

Returns:bool Whether getID3 was able to read the file.
File::_getId3()

Read the file’s embedded metadata with the getID3 library.

Returns:getID3|bool Returns getID3 object, or false if there was an exception.
File::storeFiles()

Store the files belonging to this record.

File::getStoragePath($type = 'original')

Get a storage path for the file.

Parameters:
  • $type (string) –
Returns:

string

File::setStorage($storage)

Set the storage object.

Parameters:
File::getStorage()

Get the storage object.

Returns:Omeka_Storage
File::getResourceId()

Get the ACL resource ID for the record.

File records are ‘Files’ resources.

Returns:string
File::isOwnedBy($user)

Return whether this file is owned by the given user.

Proxies to the Item’s isOwnedBy.

Parameters:
Returns:

bool

File::getFile()

Return the representative File for the record (this File itself).

Returns:File