Yii Image Tutorials

How to display image in CDetailView Yii Framework 1.0

This tutorial will help you to display the image in CDetailview widget of yii framework 1.0. We added a different funcitons in model.php to display the image with different methods like only image, image with link, image from database etc.View.php <?php $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'attributes'=>array( array( 'name'=>'image', 'type'=>'raw', 'value'=>$model->image_tag(), ), array( 'name'=>'imagelink', 'type'=>'raw', 'value'=>$model->image_with_link(), ), array( 'name'=>'image_database', 'type'=>'raw', 'value'=>$model->showphoto_from_database(), ) ), )); ?> model.phpDisplay Image Only public function image_tag(){ return […]... Read More »

Yii 1.0 Display Image Form Database

Before save the image into database, i created one ‘text’ field in mysql table to save the image code.We can show the image in CDetailview from database table of yii framework. Here i used showphoto_from_database() function to display the image from database. showproof_from_image_folder() is used to fetch uploaded image url from database and display.view.php <?php $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'attributes'=>array( array( 'name'=>'photo_id', 'type'=>'raw', 'value'=>$model->showphoto_from_database(), ), array( 'name'=>'vproof_id', 'type'=>'raw', 'value'=>$model->showproof_from_image_folder(), ) ), […]... Read More »

Create Image Thumbnails

This tutorial will help you to create “Thumbnail image”. When you upload the images using Yii Framework, You can create thumbnail image. Here i explained step by step.Step 1: First Create one simple extension for image thumbnail. Add the thumbnail_images.php file into extensions/ThumbnailImages folder.Step 2: Configure the model for files. Here i just created simple model “Files” for images <?php class Files extends CFormModel { public function rules() { return array(array('images', 'required'),); } […]... Read More »