2011-12-24 58 views
1

應用程序\意見\圖像/ 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); 
} 

回答

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")); 
+0

我仍然無法看到圖像...我認爲這一定很喜歡這種格式看照片「的圖像/影像1.JPG」 ..你把quoutes照片後.. – user1080247 2011-12-24 09:30:29

+0

我已經更新我的帖子。沒有必要把行情到底 – 2011-12-24 09:31:44

+0

也用var_dump($ thumb3)看到正在創建什麼網址 – 2011-12-24 09:32:21