应用\视图\图像/ 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);
}
答案 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"));