Méthode | Description | |
---|---|---|
attachImage ( string $absolutePath, boolean $isMain = false, string $identifier = '' ) : boolean | |
Copies the image to the assets folder and save's it in the database. | |
clearCache ( ) : array | |
Returns model images First image alwats must be main image | |
getImage ( boolean $fallbackToPlaceholder = true, mixed $placeHolderPath = null ) : array | null | ActiveRecord | Returns main model image | |
getImageByIdentifier ( string $identifier = '', $fallbackToPlaceholder = true, $placeHolderPath = null ) : array | null | ActiveRecord | Returns a model's image with a specific identifier | |
getImages ( $additionWhere = false, $fallbackToPlaceholder = true, $sort = ['position' => SORT_DESC] ) : array | |
Returns model images First image alwats must be main image | |
getRemoveRequest ( null $identifier = null ) : string | Url for removing images in image widget | |
getUploadedImageByName ( $name ) | ||
getUploadedImages ( ) | ||
removeImage ( rico\yii2images\models\Image $img ) | removes concrete model's image | |
removeImageByIdentifier ( string $identifier = '' ) : boolean | Removes an image with a specific identifier | |
removeImages ( ) | Remove all model images | |
setMainImage ( $img ) | Sets main image of model | |
uploadImage ( ) | Upload and attach images | |
uploadImageByName ( string $name = '', boolean $isMain = false, string $identifier = '' ) | Uploads and attaches an image |
Méthode | Description | |
---|---|---|
getAlias ( ) | Обновить алиасы для картинок Зачистить кэш | |
getAliasString ( ) : string | Make string part of image's url | |
getImagesFinder ( $additionWhere = false ) | *public function getImage() { if ($this->getModule()->className === null) { $imageQuery = Image::find(); } else { $class = $this->getModule()->className; $imageQuery = $class::find(); } $finder = $this->getImagesFinder(['isMain' => 1]); $imageQuery->where($finder); $imageQuery->orderBy(['isMain' => SORT_DESC, 'id' => SORT_ASC]); |
public attachImage ( string $absolutePath, boolean $isMain = false, string $identifier = '' ) : boolean | |
||
$absolutePath | string | The path were the image is uploaded |
$isMain | boolean | A flag to determine if the image is the main image |
$identifier | string | The index that has to be set for the image in the database |
Résultat | boolean | |
public clearCache ( ) : array | |
||
Résultat | array | |
public getImage ( boolean $fallbackToPlaceholder = true, mixed $placeHolderPath = null ) : array | null | ActiveRecord | ||
$fallbackToPlaceholder | boolean | A flag to determine if a placeholder has to be used when no image is found |
$placeHolderPath | mixed | The alternative placeholder path |
Résultat | array | null | ActiveRecord |
public getRemoveRequest ( null $identifier = null ) : string | ||
$identifier | null | |
Résultat | string |
public removeImage ( rico\yii2images\models\Image $img ) | ||
$img | rico\yii2images\models\Image |
public removeImageByIdentifier ( string $identifier = '' ) : boolean | ||
$identifier | string | The identifier of the image |
Résultat | boolean |