PHP Class pendalf89\filemanager\models\Mediafile

Inheritance: extends yii\db\ActiveRecord
Datei anzeigen Open project: pendalf89/yii2-filemanager Class Usage Examples

Public Properties

Property Type Description
$file
$imageFileTypes

Protected Properties

Property Type Description
$tagIds array | null

Public Methods

Method Description
addOwner ( integer $owner_id, string $owner, string $owner_attribute ) : boolean Add owner to mediafiles table
afterDelete ( )
afterSave ( $insert, $changedAttributes )
attributeLabels ( )
beforeDelete ( )
behaviors ( )
createDefaultThumb ( array $routes ) Create default thumbnail
createThumbs ( array $routes, array $presets ) : boolean Create thumbs for this image
deleteFile ( array $routes ) : boolean Delete file
deleteThumbs ( array $routes ) Delete thumbnails for current image
findByTypes ( array $types ) : array | ActiveRecord[] Search models by file types
findByUrl ( $url ) : static Find model by url
getDefaultThumbUrl ( $baseUrl = '' ) : string
getDefaultUploadThumbUrl ( $baseUrl = '' ) : string
getFileSize ( ) : string
getImagesList ( Module $module ) : array
getLastChanges ( ) : integer
getOriginalImageSize ( array $routes, string $delimiter = ' × ' ) : string This method wrap getimagesize() function
getOriginalImageSizes ( array $routes ) : array This method wrap getimagesize() function
getOwners ( ) : ActiveQuery
getTagIds ( ) : array | null
getTags ( ) : ActiveQuery
getThumbImage ( string $alias, array $options = [] ) : string Thumbnail image html tag
getThumbUrl ( string $alias ) : string
getThumbs ( ) : array
init ( )
isImage ( ) : boolean
loadOneByOwner ( $owner, $owner_id, $owner_attribute )
removeOwner ( integer $owner_id, string $owner, string $owner_attribute ) : boolean Remove this mediafile owner
rules ( )
saveUploadedFile ( array $routes, boolean $rename = false ) : boolean Save just uploaded file
setTagIds ( $value )
tableName ( )

Protected Methods

Method Description
getThumbFilename ( $original, $extension, $alias, $width, $height ) : string Returns thumbnail name

Method Details

addOwner() public method

Add owner to mediafiles table
public addOwner ( integer $owner_id, string $owner, string $owner_attribute ) : boolean
$owner_id integer owner id
$owner string owner identification name
$owner_attribute string owner identification attribute
return boolean save result

afterDelete() public method

public afterDelete ( )

afterSave() public method

public afterSave ( $insert, $changedAttributes )

attributeLabels() public method

public attributeLabels ( )

beforeDelete() public method

public beforeDelete ( )

behaviors() public method

public behaviors ( )

createDefaultThumb() public method

Create default thumbnail
public createDefaultThumb ( array $routes )
$routes array see routes in module config

createThumbs() public method

Create thumbs for this image
public createThumbs ( array $routes, array $presets ) : boolean
$routes array see routes in module config
$presets array thumbs presets. See in module config
return boolean

deleteFile() public method

Delete file
public deleteFile ( array $routes ) : boolean
$routes array see routes in module config
return boolean

deleteThumbs() public method

Delete thumbnails for current image
public deleteThumbs ( array $routes )
$routes array see routes in module config

findByTypes() public static method

Search models by file types
public static findByTypes ( array $types ) : array | ActiveRecord[]
$types array file types
return array | yii\db\ActiveRecord[]

findByUrl() public static method

Find model by url
public static findByUrl ( $url ) : static
$url
return static

getDefaultThumbUrl() public method

public getDefaultThumbUrl ( $baseUrl = '' ) : string
$baseUrl
return string default thumbnail for image

getDefaultUploadThumbUrl() public method

public getDefaultUploadThumbUrl ( $baseUrl = '' ) : string
$baseUrl
return string default thumbnail for image

getFileSize() public method

public getFileSize ( ) : string
return string file size

getImagesList() public method

public getImagesList ( Module $module ) : array
$module pendalf89\filemanager\Module
return array images list

getLastChanges() public method

public getLastChanges ( ) : integer
return integer last changes timestamp

getOriginalImageSize() public method

This method wrap getimagesize() function
public getOriginalImageSize ( array $routes, string $delimiter = ' × ' ) : string
$routes array see routes in module config
$delimiter string delimiter between width and height
return string image size like '1366x768'

getOriginalImageSizes() public method

This method wrap getimagesize() function
public getOriginalImageSizes ( array $routes ) : array
$routes array see routes in module config
return array

getOwners() public method

public getOwners ( ) : ActiveQuery
return yii\db\ActiveQuery

getTagIds() public method

public getTagIds ( ) : array | null
return array | null

getTags() public method

public getTags ( ) : ActiveQuery
return yii\db\ActiveQuery

getThumbFilename() protected method

Returns thumbnail name
protected getThumbFilename ( $original, $extension, $alias, $width, $height ) : string
$original
$extension
$alias
$width
$height
return string

getThumbImage() public method

Thumbnail image html tag
public getThumbImage ( string $alias, array $options = [] ) : string
$alias string thumbnail alias
$options array html options
return string Html image tag

getThumbUrl() public method

public getThumbUrl ( string $alias ) : string
$alias string thumb alias
return string thumb url

getThumbs() public method

public getThumbs ( ) : array
return array thumbnails

init() public method

public init ( )

isImage() public method

public isImage ( ) : boolean
return boolean if type of this media file is image, return true;

loadOneByOwner() public static method

public static loadOneByOwner ( $owner, $owner_id, $owner_attribute )

removeOwner() public static method

Remove this mediafile owner
public static removeOwner ( integer $owner_id, string $owner, string $owner_attribute ) : boolean
$owner_id integer owner id
$owner string owner identification name
$owner_attribute string owner identification attribute
return boolean delete result

rules() public method

public rules ( )

saveUploadedFile() public method

Save just uploaded file
public saveUploadedFile ( array $routes, boolean $rename = false ) : boolean
$routes array routes from module settings
$rename boolean
return boolean

setTagIds() public method

public setTagIds ( $value )
$value

tableName() public static method

public static tableName ( )

Property Details

$file public_oe property

public $file

$imageFileTypes public_oe static_oe property

public static $imageFileTypes

$tagIds protected_oe property

protected array|null $tagIds
return array | null