Yii 1.1: uploaderbehavior

a file upload behavior
3 followers

a file upload behavior

Requirements

...requirements of using this extension (testing 1.1.4)...

Usage

...copy it to you components directory or other directory, import it...

...can use code blocks like the following...

public function behaviors() {
        return array(            
            'UploaderBehavior' => array(
                'class' => 'ext.behaviors.UploaderBehavior',
                'uploadSavedPathAttributes' => array(
                    'picture_saved_path' => array(
                        'fileType' => 'image',
                        'fileName' => 'attribute name, if fileName attribute is not in required rule and you don not input it, fileName attribute will set it to you upload filename',
                        'fileSize' => 'file size attribute name',
                        'fileExt' => 'file extension attribute name',
                        'generateThumbnail' => true,
                    ),
                ),
            ),
        );
    }

Notice

  1. if you will generate image thumbnail, you must set attribute fileType to 'image' and set generateThumbnail to true.
  2. Generate picture thumbnail use EasyPHPThumb extension, you must download and setting it.
  3. picture thumbnail width and heigth settings is saved in database now.
  4. Thumbnail saved path don't saved in database, if a picture filename is a.jpg, thumbnail filename will is a_thumb.jpg

Resources

...external resources for this extension...

Be the first person to leave a comment

Please to leave your comment.

Create extension