PHP Class Habari\Media

Show file Open project: habari/system

Public Properties

Property Type Description
$silos

Public Methods

Method Description
copy ( string $pathfrom, string $pathto ) : boolean Copy the asset using the specified from and to paths
delete ( string $path ) : boolean Delete the asset at the specified virtual path
dir ( string $path = '' ) : array Retrieve an array of media assets stored at a virtual path
get ( string $path, array $qualities = null ) : MediaAsset Get the MediaAsset stored at a virtual path
get_silo ( mixed &$silo, boolean $parse_path = false ) : habari\MediaSilo Return the instance of a silo
highlights ( mixed $path = null ) : array Return an array of highlighted (featured) assets from all silos
init_silos ( ) Initialize the internal list of silo instances
move ( string $pathfrom, string $pathto ) : boolean Move the asset using the specified from and to paths A shortcut for Media::copy() then Media::delete()
permissions ( mixed $path ) : array Return the permissions available to the current user on the specified path
prepare ( string $path ) : MediaAsset Fetch an empty MediaAsset with the available metadata keys pre-allocated $asset = Media::prepare('silotype/foo/bar'); foreach($asset->get_info() as $key => $value) echo "$key : $value";
put ( MediaAsset $filedata, string $path = null ) : boolean Store the asset at the specified virtual path

Method Details

copy() public static method

Copy the asset using the specified from and to paths
public static copy ( string $pathfrom, string $pathto ) : boolean
$pathfrom string The virtual path source
$pathto string The virtual path destination
return boolean true on success

delete() public static method

Delete the asset at the specified virtual path
public static delete ( string $path ) : boolean
$path string The virtual path of the asset to delete
return boolean true on success

dir() public static method

Retrieve an array of media assets stored at a virtual path
public static dir ( string $path = '' ) : array
$path string The virtual path of the directory to retrieve
return array A list of files and directories in that path

get() public static method

Get the MediaAsset stored at a virtual path
public static get ( string $path, array $qualities = null ) : MediaAsset
$path string The virtual path of the file to retrieve
$qualities array Qualities of the image to return (such as 'thumbnail' or 'size')
return MediaAsset The requested asset

get_silo() public static method

Return the instance of a silo
public static get_silo ( mixed &$silo, boolean $parse_path = false ) : habari\MediaSilo
$silo mixed A silo instance or the name of a silo
$parse_path boolean If true, parse the siloname from the path and return the remainder path by reference
return habari\MediaSilo The requested silo

highlights() public static method

Return an array of highlighted (featured) assets from all silos
public static highlights ( mixed $path = null ) : array
$path mixed The name of a silo or a silo instance. If empty, all silos are returned.
return array An array of MediaAsset highlight assets

init_silos() public static method

Initialize the internal list of silo instances
public static init_silos ( )

move() public static method

Move the asset using the specified from and to paths A shortcut for Media::copy() then Media::delete()
public static move ( string $pathfrom, string $pathto ) : boolean
$pathfrom string The virtual path source
$pathto string The virtual path destination
return boolean true on success

permissions() public static method

Return the permissions available to the current user on the specified path
public static permissions ( mixed $path ) : array
$path mixed The name of a silo or a silo instance.
return array An array of permission constants (read, write, etc.)

prepare() public static method

Fetch an empty MediaAsset with the available metadata keys pre-allocated $asset = Media::prepare('silotype/foo/bar'); foreach($asset->get_info() as $key => $value) echo "$key : $value";
public static prepare ( string $path ) : MediaAsset
$path string The virtual path at which the asset will be stored
return MediaAsset An empty, intialized asset instance

put() public static method

Store the asset at the specified virtual path
public static put ( MediaAsset $filedata, string $path = null ) : boolean
$filedata MediaAsset The asset to store
$path string The virtual path where the asset will be stored
return boolean true on success

Property Details

$silos static public property

static public $silos