Created
December 3, 2011 09:00
-
-
Save jamband/1426610 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Item class file. | |
*/ | |
class Item extends CActiveRecord | |
{ | |
... | |
/** | |
* @see CModel::rules() | |
*/ | |
public function rules() | |
{ | |
return array( | |
array('title', 'length', 'max'=>50), | |
array( | |
'image', | |
'file', | |
'safe' => true, | |
//'allowEmpty' => true, | |
'types' => 'jpg,png,gif', | |
'maxSize' => 1024*1024*1, | |
'message' => '{attribute}が未選択です', | |
'on' => 'insert,change', | |
), | |
); | |
} | |
/** | |
* @see CModel::behaviors() | |
*/ | |
public function behaviors() | |
{ | |
return array( | |
'ImageUploadBehavior' => array( | |
'class' => 'application.components.ImageUploadBehavior', | |
'createThumb' => true, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment