Author: Alexander Kochetov (creocoder@gmail.com)
Author: Antonio Ramirez (hola@2amigos.us)
Inheritance: extends yii\base\Behavior
Example #1
0
 public function behaviors()
 {
     //        ini_set('memory_limit', '64M');
     return [['class' => Taggable::className()], Taggable::className(), TimestampBehavior::className(), 'galleryBehavior' => ['class' => GalleryBehavior::className(), 'type' => 'objreservation', 'extension' => 'jpg', 'directory' => Yii::getAlias('@root') . '/images/product/gallery', 'url' => '/images/product/gallery', 'versions' => ['small' => function ($img) {
         /** @var ImageInterface $img */
         return $img->copy()->thumbnail(new Box(100, 100));
     }, 'medium' => function ($img) {
         /** @var ImageInterface $img */
         $dstSize = $img->getSize();
         $maxWidth = 480;
         if ($dstSize->getWidth() > $maxWidth) {
             $dstSize = $dstSize->widen($maxWidth);
         }
         return $img->copy()->resize($dstSize);
     }]]];
 }
Example #2
0
 public function behaviors()
 {
     return ['image' => ['class' => 'rico\\yii2images\\behaviors\\ImageBehave'], 'createUpdate' => ['class' => CreateUpdateBehavior::className()], ['class' => Taggable::className()], 'slug' => ['class' => 'app\\behaviors\\Slug', 'in_attribute' => 'title', 'out_attribute' => 'slug', 'translit' => TRUE]];
 }
 public function behaviors()
 {
     return ['Images' => ['class' => ImageBehavior::className(), 'ownerClass' => 'stronglab\\productcatalog\\models\\Products'], 'Taggable' => ['class' => Taggable::className(), 'attribute' => 'category_ids', 'name' => 'id', 'relation' => 'categories']];
 }
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [TimestampBehavior::className(), BlameableBehavior::className(), Taggable::className()];
 }