This column assumes that the filename is saved as a path to the image that is to be rendered. If no pathPrefix is given, it assumes Yii::app()->baseUrl as a prefix for the image.
extract the file to your application components/ directory.
Yii::import('application.components.EImageColumn'); $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'photo-grid', 'dataProvider'=>$model->search(), 'filter'=>$model, 'columns'=>array( 'id', array( 'class'=>'EImageColumn', 'name' => 'filename', 'htmlOptions' => array('style' => 'width: 150px;'), ), 'album.title', 'album.category.title', 'title', 'filename', array( 'class'=>'CButtonColumn', ), ), ));
Total 4 comments
Hi
I've changed renderDataCellContent function, to support names with relations, like 'name'=>'Post.Author'
nice job
Nice. Would i have found your ImageColumn, i would had used yours rather than doing a own. Your 'imagePathExpression' idea may be better than mine, it allows for more flexible path constructions ;)
I've created another implementation a while ago.
Leave a comment
Please login to leave your comment.