Create block for ImageSlider extension

(1) Firstly create the ImageSlider.php file in app/code/local/Mywork/ImageSlider/Block/Adminhtml/

<?php 
class Mywork_ImageSlider_Block_Adminhtml_ImageSlider extends Mage_Adminhtml_Block_Widget_Grid_Container
{
    public function __construct()
    {
       $this->_controller = 'adminhtml_imageslider';
       $this->_blockGroup = 'imageslider';
       $this->_headerText = Mage::helper('imageslider')->__('Image Slider');
       $this->_addButtonLabel = Mage::helper('imageslider')->__('Add Image');
       parent::__construct();
       //$this->_removeButton('add');
    }
}
?>

Note:- (1) in this file $this->_controller represent the controller.
(2) $this->_blockGroup is represent the module name.

(2) Create the Grid.php file in app/code/local/Mywork/ImageSlider/Block/Adminhtml/ImageSlider/

<?php

class Mywork_ImageSlider_Block_Adminhtml_ImageSlider_Grid extends Mage_Adminhtml_Block_Widget_Grid
{

  public function __construct()
  {
      parent::__construct();
      $this->setId('imgsliderGrid');
      $this->setDefaultSort('img_id');
      $this->setDefaultDir('DESC');
      $this->setSaveParametersInSession(true);
  }

  protected function _prepareCollection()
  {
     $collection = Mage::getModel('imageslider/imgslider')->getCollection();
     $this->setCollection($collection);
     return parent::_prepareCollection();
  }

  protected function _prepareColumns()
  {  
      $this->addColumn('img_id', array(
          'header'    => Mage::helper('imageslider')->__('ID'),
          'align'     =>'right',
          'width'     => '50px',
          'index'     => 'img_id',
      ));
      
      $this->addColumn('img_name', array(
	'header'=>Mage::helper('imageslider')->__('Image Title'),
        //'filter'=>false,
        'index'=>'img_name',
        'align' => 'left',
        'width'     => '50px',
	  
		)); 
		
     $this->addColumn('image', array(
			'header'    => Mage::helper('imageslider')->__('Image'),
			'filter'=>false,
			'align'     =>'left',
			'width'     => '50px',
			'index'     => 'image',
			'renderer'  => 'imageslider/adminhtml_imageslider_renderer_imagename',
      ));
	  
	
	  
	 
	  $this->addColumn('img_desc', array(
			'header'    => Mage::helper('imageslider')->__('Image Description'),
			'align'     =>'left',
			'filter'=>false,
			'width'     => '80px',
			'index'     => 'img_desc',
      ));
	  
	  $this->addColumn('status', array(
			'header'    => Mage::helper('imageslider')->__('Status'),
			'align'     =>'left',
			//'filter'=>false,
			'width'     => '80px',
			'index'     => 'status',
			'type'      => 'options',
            'options'   => array(
              1 => 'Enabled',
              0 => 'Disabled',
          ),
      ));
	  
	  
	  $this->addColumn('action',
            array(
                'header'    =>  Mage::helper('imageslider')->__('Action'),
                'width'     => '100',
                'type'      => 'action',
                'getter'    => 'getId',
                'actions'   => array(
				
				 array(
                        'caption'   => Mage::helper('imageslider')->__('Edit'),
                        'url'       => array('base'=> '*/*/edit'),
                        'field'     => 'id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',
                'is_system' => true,
        ));
	  
	  
	  
	  /*if (!Mage::app()->isSingleStoreMode()) {
		$this->addColumn('store_id', array(
			'header'        => Mage::helper('bannerpro')->__('Store View'),
			'index'         => 'store_id',
			'type'          => 'store',
			'width'			=> '150px',
			'store_all'     => true,
			'store_view'    => true,
			'sortable'      => false,
			'filter_condition_callback'
							=> array($this, '_filterStoreCondition'),
		));
	   }*/
   
      return parent::_prepareColumns();
  }
  
  
    protected function _prepareMassaction()
    {
    	$this->setMassactionIdField('img_id');
        $this->getMassactionBlock()->setFormFieldName('delete_massimage');
        $this->getMassactionBlock()->addItem('delete', array(
             'label'    => Mage::helper('imageslider')->__('Delete'),
             'url'      => $this->getUrl('*/*/massDelete'),
             'confirm'  => Mage::helper('imageslider')->__('Are you sure?')
        ));
		
		$statuses = Mage::getSingleton('imageslider/status')->getOptionArray();
       // array_unshift($statuses, array('label'=>'', 'value'=>''));
		//print_r($statuses); die;
		
        $this->getMassactionBlock()->addItem('status', array(
             'label'=> Mage::helper('imageslider')->__('Change status'),
             'url'  => $this->getUrl('*/*/massStatus', array('_current'=>true)),
             'additional' => array(
                    'visibility' => array(
                         'name' => 'status',
                         'type' => 'select',
                         'class' => 'required-entry',
                         'label' => Mage::helper('imageslider')->__('Status'),
                         'values' => $statuses
                     )
             )
        ));
		
		return $this;
    }
  
   /**
     * Row click URL
     *
     * @return string
     */
    public function getRowUrl($row)
    {
        return $this->getUrl('*/*/edit', array('img_id' => $row->getId()));
    }	
}

Note:- 1) this file represent the image slider data into a grid view.

(3) Create the Edit.php file in app/code/local/Mywork/ImageSlider/Block/Adminhtml/ImageSlider/

<?php

class Mywork_ImageSlider_Block_Adminhtml_ImageSlider_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
  public function __construct()
  {
	parent::__construct();
	$this->_controller = 'adminhtml_imageslider';
        $this->_blockGroup = 'imageslider';
        $this->_mode='edit';
	//$this->_headerText = Mage::helper('imageslider')->__('Image Slider Information');
	$this->_updateButton('save', 'label', Mage::helper('imageslider')->__('Save Image'));
        $this->_updateButton('delete', 'label', Mage::helper('imageslider')->__('Delete Image'));
       
  }
  
  /**
     * Get edit form container header text
     *
     * @return string
     */
    public function getHeaderText()
    {
         if (Mage::registry('imageslider_model')->getId()) {
         return Mage::helper('imageslider')->__('Edit Image Slider');
         }
         else {
            return Mage::helper('imageslider')->__('New Image Slider');
          }
    }
  
	
}

(4) Create the Form.php file in app/code/local/Mywork/ImageSlider/Block/Adminhtml/ImageSlider/Edit/

<?php
class Mywork_ImageSlider_Block_Adminhtml_ImageSlider_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{

    /**
     * Init form
     */
    public function __construct()
    {
        parent::__construct();
        $this->setId('images_form');
       // $this->setTitle(Mage::helper('adminhtml')->__('Images Information'));
    }


    protected function _prepareForm()
    {
		$model = Mage::registry('imageslider_model');
        $form = new Varien_Data_Form(array(
            'id'        => 'edit_form',
            'action'    => $this->getUrl('*/*/save'),
            'method'    => 'post',
			'enctype' => 'multipart/form-data'
        ));

        $fieldset = $form->addFieldset('add_imgslider_form', array('legend' => Mage::helper('imageslider')->__('Image Slider')));
        
		if ($model->getId()) {
            $fieldset->addField('img_id', 'hidden', array(
                'name' => 'img_id',
				
            ));
		}
		
		
        $fieldset->addField('img_name', 'text', array(
            'label' => Mage::helper('imageslider')->__('Filename'),
            'name'  => 'img_name',
            'required' => true,
            'note'  => Mage::helper('imageslider')->__('example: slider1'),
           // 'value' => $model->getImgName()
        ));
		
		
		
		
		$fieldset->addField('image', 'image', array(
          'label'     => Mage::helper('imageslider')->__('Images'),
          'class'     => 'required-file Please select a file',
          'required'  =>  false,
          'name'      => 'image',
		  //'value' => $model->getImgDesc()
		));
		
		
		$fieldset->addField('img_desc', 'textarea', array(
          'label'     => Mage::helper('imageslider')->__('Image Description'),
         // 'class'     => 'required-file Please select a file',
          'required'  =>  false,
          'name'      => 'img_desc',
		 //'value' => $model->getImgDesc()
		 
	    ));
		

	   $form->setUseContainer(true);
       $this->setForm($form);
	   
	  if ( Mage::getSingleton('adminhtml/session')->getImagesliderModel() )
      {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getImagesliderModel());
          Mage::getSingleton('adminhtml/session')->setBannerproData(null);
      } elseif ( Mage::registry('imageslider_model') ) {
      	   $form->setValues(Mage::registry('imageslider_model')->getData());
      }
	   
	   
       return parent::_prepareForm();
    }

}

(5) Create the Imagename.php file in app/code/local/Mywork/ImageSlider/Block/Adminhtml/ImageSlider/Renderer/

<?php
class Mywork_ImageSlider_Block_Adminhtml_ImageSlider_Renderer_Imagename extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
	public function render(Varien_Object $row)
    {
		if($row['image']!=""){
			$img_directory=Mage::getConfig()->getBaseDir('media').'/'.$row['image'];
			$image_url= Mage::getBaseUrl('media').$row['image'];
			 if(file_exists($img_directory)){
				return '<img src="'.$image_url.'" width="50px" />'; 
			 }else{
				 return '';
			 }
			 
		}else{
			return '';
        }
		
	 }
	
}
 ?>