PHP code example of black-lamp / yii2-imagable
1. Go to this page and download the library: Download black-lamp/yii2-imagable library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
black-lamp / yii2-imagable example snippets
'imagable' => [
'class' => 'bl\imagable\Imagable',
'imageClass' => 'bl\imagable\instances\CreateImageImagine',
'categories' => [
'origin' => false,
'category' => [
'galery' => [
'origin' => true,
],
'galery/more' => [
'origin' => false,
],
'avatars' => [
'size' => [
'big' => [
'width' => 1000,
'height' => 500,
]
]
]
]
]
...
$imageName = \Yii::$app->imagable->create('avatars', 'pathToImage');
// Or
$imageName = \Yii::$app->imagable->createMultiply(['avatars', 'galery/more'], 'pathToImage');
$fullPathToImage = \Yii::$app->imagable->get('avatars', 'big', $imageName);
$isDeleted = \Yii::$app->imagable->delete('avatars', $imageName);
//To action
/** @var Imagable $image */
$imagable = \Yii::$app->imagable;
$imagable->dataProvider = [
'key' => $data
];
//...
//To class
class ImageClass extends Object implements CreateImageInterface
{
public $dataProvider;
public function init()
{
parent::init(); // TODO: Change the autogenerated stub
echo $this->dataProvider['key'];
}
//...
}
php composer.phar install black-lamp/yii2-imagable