PHP Class MediaModel, addons

Inheritance: extends Ajde_Model
Mostrar archivo Open project: vanilla/addons Class Usage Examples

Public Methods

Method Description
__construct ( ) MediaModel constructor.
delete ( array $Media = [], array | boolean $Options = [] )
deleteParent ( $ParentTable, $ParentID )
getID ( integer $MediaID, boolean $DatasetType = false, array $Options = [] ) : array | false Get a media row by ID.
getImageSize ( string $Path ) : array If passed path leads to an image, return size
pathUploads ( ) : string Return path to upload folder.
preloadDiscussionMedia ( $DiscussionID, $CommentIDList ) : Gdn_DataSet
reassign ( integer $ForeignID, string $ForeignTable, $NewForeignID, $NewForeignTable ) : object Retrieve all media for a foreign record.
thumbnailHeight ( ) : boolean | mixed
thumbnailUrl ( &$Media ) : mixed | string
thumbnailWidth ( ) : boolean | mixed
url ( $Media ) : mixed | string

Method Details

__construct() public method

MediaModel constructor.
public __construct ( )

delete() public method

public delete ( array $Media = [], array | boolean $Options = [] )
$Media array The media row.
$Options array | boolean Either a boolean that says whether or not to delete the file or an array with a

deleteParent() public method

public deleteParent ( $ParentTable, $ParentID )
$ParentTable
$ParentID

getID() public method

Get a media row by ID.
public getID ( integer $MediaID, boolean $DatasetType = false, array $Options = [] ) : array | false
$MediaID integer The ID of the media entry.
$DatasetType boolean Not used.
$Options array Not used.
return array | false Returns the media row or **false** if it isn't found.

getImageSize() public static method

If passed path leads to an image, return size
public static getImageSize ( string $Path ) : array
$Path string Path to file.
return array [0] => Height, [1] => Width.

pathUploads() public static method

Return path to upload folder.
public static pathUploads ( ) : string
return string Path to upload folder.

preloadDiscussionMedia() public method

public preloadDiscussionMedia ( $DiscussionID, $CommentIDList ) : Gdn_DataSet
$DiscussionID
$CommentIDList
return Gdn_DataSet

reassign() public method

Retrieve all media for a foreign record.
public reassign ( integer $ForeignID, string $ForeignTable, $NewForeignID, $NewForeignTable ) : object
$ForeignID integer
$ForeignTable string Lowercase.
return object SQL results.

thumbnailHeight() public static method

public static thumbnailHeight ( ) : boolean | mixed
return boolean | mixed

thumbnailUrl() public static method

public static thumbnailUrl ( &$Media ) : mixed | string
$Media
return mixed | string

thumbnailWidth() public static method

public static thumbnailWidth ( ) : boolean | mixed
return boolean | mixed

url() public static method

public static url ( $Media ) : mixed | string
$Media
return mixed | string