Example #1
1
 public function behaviors()
 {
     return ['image' => ['class' => UploadImageBehavior::className(), 'attribute' => 'cover', 'scenarios' => ['default', 'create', 'update'], 'placeholder' => '@webroot/img/releases/no-image.jpg', 'path' => '@webroot/img/releases/{id}', 'url' => '@web/img/releases/{id}', 'thumbs' => ['thumb' => ['width' => 400, 'quality' => 90], 'preview' => ['width' => 200, 'height' => 200]]]];
 }
Example #2
0
 public function behaviors()
 {
     return [['class' => UploadImageBehavior::className(), 'attribute' => 'image_url', 'scenarios' => ['insert', 'update'], 'placeholder' => $this->module->image_placeholder, 'path' => $this->module->image_path, 'url' => $this->module->image_url, 'thumbs' => $this->module->image_thumbs]];
 }
Example #3
0
 public function behaviors()
 {
     return [['class' => SluggableBehavior::className(), 'attribute' => 'title', 'slugAttribute' => 'slug'], ['class' => UploadImageBehavior::className(), 'attribute' => 'image', 'scenarios' => ['default'], 'path' => '@webroot/uploads/posts/{id}', 'url' => '@web/uploads/posts/{id}', 'thumbs' => ['thumb' => ['width' => 200, 'quality' => 90]]], ['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['category_ids' => 'categories']]];
 }
Example #4
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [TimestampBehavior::className(), SettingModel::className(), ['class' => BlameableBehavior::className(), 'createdByAttribute' => 'create_user_id', 'updatedByAttribute' => 'update_user_id'], ['class' => SluggableBehavior::className(), 'attribute' => 'title', 'slugAttribute' => 'slug'], ['class' => \mongosoft\file\UploadImageBehavior::className(), 'attribute' => 'image', 'scenarios' => ['insert', 'update'], 'placeholder' => '@webroot/uploads/user/non_image.png', 'createThumbsOnSave' => true, 'path' => '@webroot/uploads/news/{id}', 'url' => '@web/uploads/news/{id}', 'thumbPath' => '@webroot/uploads/news/{id}/thumb', 'thumbUrl' => '@web/uploads/news/{id}/thumb', 'thumbs' => ['thumb' => ['width' => 340, 'quality' => 100, 'mode' => 'outbound']]], 'trans' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['slug', 'title', 'description', 'content', 'link', 'meta_title', 'meta_keywords', 'meta_description', 'settings']]];
 }
Example #5
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [TimestampBehavior::className(), SettingModel::className(), ['class' => SluggableBehavior::className(), 'attribute' => 'title_h1', 'slugAttribute' => 'slug'], ['class' => \mongosoft\file\UploadImageBehavior::className(), 'attribute' => 'background_image', 'scenarios' => ['insert', 'update'], 'placeholder' => '@webroot/uploads/user/non_image.png', 'createThumbsOnSave' => true, 'path' => '@webroot/uploads/background_image/category_{id}', 'url' => '@web/uploads/background_image/category_{id}'], 'trans' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['slug', 'title', 'subtitle', 'title_h1', 'content', 'description', 'meta_title', 'meta_keywords', 'meta_description', 'settings']]];
 }
Example #6
0
 public function behaviors()
 {
     return [['class' => \mongosoft\file\UploadImageBehavior::className(), 'attribute' => 'preview', 'scenarios' => ['update', 'insert'], 'placeholder' => '@webroot/uploads/no-book.jpg', 'path' => '@webroot/uploads', 'url' => '@web/uploads', 'thumbs' => ['preview' => ['width' => 100, 'height' => 100, 'quality' => 90], 'big_thumb' => ['width' => 350, 'quality' => 90], 'thumb' => ['width' => 120, 'height' => 80, 'quality' => 100]]], 'timestamp' => ['class' => 'yii\\behaviors\\TimestampBehavior', 'attributes' => [self::EVENT_BEFORE_INSERT => ['date_create', 'date_update'], self::EVENT_BEFORE_UPDATE => ['date_update']]]];
 }
Example #7
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [['class' => UploadImageBehavior::className(), 'attribute' => 'image', 'scenarios' => ['insert', 'update'], 'path' => '@webroot/upload/user/{id}', 'url' => '@web/upload/user/{id}', 'thumbs' => ['thumb' => ['width' => 400, 'quality' => 90], 'preview' => ['width' => 200, 'height' => 200]]]];
 }
Example #8
0
 /**
  * See https://github.com/mongosoft/yii2-upload-behavior
  */
 public function behaviors()
 {
     return [['class' => \mongosoft\file\UploadImageBehavior::className(), 'attribute' => 'image_file', 'scenarios' => ['default'], 'path' => '@uploadroot/post/image_file/{id}', 'url' => '@upload/post/image_file/{id}']];
 }
Example #9
0
 public function behaviors()
 {
     return [['class' => \mongosoft\file\UploadImageBehavior::className(), 'attribute' => 'avatar', 'scenarios' => ['insert', 'update'], 'placeholder' => '@webroot/uploads/user/non_image.png', 'createThumbsOnSave' => true, 'thumbs' => ['thumb' => ['width' => 200, 'height' => 200, 'quality' => 100, 'mode' => 'outbound']], 'path' => '@webroot/uploads/user/_{user_id}', 'url' => '@web/uploads/user/_{user_id}']];
 }