PHP Class pendalf89\filemanager\models\Mediafile

Inheritance: extends yii\db\ActiveRecord
Afficher le fichier Open project: pendalf89/yii2-filemanager Class Usage Examples

Méthodes publiques

Свойство Type Description
$file
$imageFileTypes

Protected Properties

Свойство Type Description
$tagIds array | null

Méthodes publiques

Méthode 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 ( )

Méthodes protégées

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

Method Details

addOwner() public méthode

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
Résultat boolean save result

afterDelete() public méthode

public afterDelete ( )

afterSave() public méthode

public afterSave ( $insert, $changedAttributes )

attributeLabels() public méthode

public attributeLabels ( )

beforeDelete() public méthode

public beforeDelete ( )

behaviors() public méthode

public behaviors ( )

createDefaultThumb() public méthode

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

createThumbs() public méthode

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
Résultat boolean

deleteFile() public méthode

Delete file
public deleteFile ( array $routes ) : boolean
$routes array see routes in module config
Résultat boolean

deleteThumbs() public méthode

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

findByTypes() public static méthode

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

findByUrl() public static méthode

Find model by url
public static findByUrl ( $url ) : static
$url
Résultat static

getDefaultThumbUrl() public méthode

public getDefaultThumbUrl ( $baseUrl = '' ) : string
$baseUrl
Résultat string default thumbnail for image

getDefaultUploadThumbUrl() public méthode

public getDefaultUploadThumbUrl ( $baseUrl = '' ) : string
$baseUrl
Résultat string default thumbnail for image

getFileSize() public méthode

public getFileSize ( ) : string
Résultat string file size

getImagesList() public méthode

public getImagesList ( Module $module ) : array
$module pendalf89\filemanager\Module
Résultat array images list

getLastChanges() public méthode

public getLastChanges ( ) : integer
Résultat integer last changes timestamp

getOriginalImageSize() public méthode

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
Résultat string image size like '1366x768'

getOriginalImageSizes() public méthode

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

getOwners() public méthode

public getOwners ( ) : ActiveQuery
Résultat yii\db\ActiveQuery

getTagIds() public méthode

public getTagIds ( ) : array | null
Résultat array | null

getTags() public méthode

public getTags ( ) : ActiveQuery
Résultat yii\db\ActiveQuery

getThumbFilename() protected méthode

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

getThumbImage() public méthode

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

getThumbUrl() public méthode

public getThumbUrl ( string $alias ) : string
$alias string thumb alias
Résultat string thumb url

getThumbs() public méthode

public getThumbs ( ) : array
Résultat array thumbnails

init() public méthode

public init ( )

isImage() public méthode

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

loadOneByOwner() public static méthode

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

removeOwner() public static méthode

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
Résultat boolean delete result

rules() public méthode

public rules ( )

saveUploadedFile() public méthode

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

setTagIds() public méthode

public setTagIds ( $value )
$value

tableName() public static méthode

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
Résultat array | null