如何在图像助手引号之间放置图像变量

时间:2011-12-24 09:14:43

标签: cakephp cakephp-1.3

应用\视图\图像/ view.ctp
这是视图代码..我需要帮助来获取图像

            <?php
            // initialise a counter for striping the table
            $count = 0;

            // loop through and display format
            foreach($images as $image){
                // stripes the table by adding a class to every other row
                $class = ( ($count % 2) ? " class='altrow'": '' );
                // increment count
                $count++;



  $full3 = '/img/images/'.$image['Image'];
  $thumb3 = $this->Html->image('images/image-1.jpg',array("width"=>"60", "height"=>"40"));
  var_dump($full3) ;

      $this->Html->link($thumb3,$full3,array('escape' => false, 'rel' => 'lightbox[plants]','title'=>'thanks allah for help me'));
         }
          ?>

控制器代码是images_controller代码..

function view($id = null) {
    if (!$id) {
        $this->Session->setFlash(__('Invalid image', true));
        $this->redirect(array('action' => 'index'));
    }
    $this->set('image', $this->Image->read(null, $id));
 $images=  $this->Image->find('all');
   $this->set('images', $images);
}

1 个答案:

答案 0 :(得分:2)

替换此行

echo $thumb3 = $this->Html->image('images"/".$image['Image']['img_file']',array('width'=>"60", 'height'=>"40")); 

echo $thumb3 = $this->Html->image("images/".$image['Image']['img_file'],array("width"=>"60", "height"=>"40"));