예제 #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);
     }]]];
 }
예제 #2
0
파일: Blog.php 프로젝트: kdes70/hotel.lok
 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]];
 }
예제 #3
0
 public function behaviors()
 {
     return ['Images' => ['class' => ImageBehavior::className(), 'ownerClass' => 'stronglab\\productcatalog\\models\\Products'], 'Taggable' => ['class' => Taggable::className(), 'attribute' => 'category_ids', 'name' => 'id', 'relation' => 'categories']];
 }
예제 #4
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [TimestampBehavior::className(), BlameableBehavior::className(), Taggable::className()];
 }