如何显示图像

时间:2013-10-29 07:59:57

标签: image zend-framework controller

在Zend Framework中,我试图通过我的控制器显示图像。

class PictController extends Zend_Controller_Action
{
    public function indexAction()
    { 
     $objpict = new Application_Model_Page();   
     $objpict->CheminPictures(Application_Model_String::ExtractNamePict($this->getParam('niveau0')));   
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->getHelper('layout')->disableLayout();
     header('Content-Type: image/jpeg');
     header('Content-Length: ' . filesize($file));
     echo file_get_contents($file);
     exit;   

    } 

}

也创造了一条道路,但也没有考虑到它!

$routeRegex = new Zend_Controller_Router_Route_Regex(
   'img/([a-z-0-9-/-]+).jpg',
   array('controller' =>'pict','action' => 'index'),
   array(1 => 'niveau0',2 => 'niveau1',3 => 'niveau2'),'img/%s.jpg');
 $this->_routeur->addRoute('routeimage', $routeRegex);

这不起作用。它会返回我页面的网址...

<img alt="montitre" src="<?php echo $this->url(array('controller' => 'pict', 'action' => 'index')); ?>" >

如何从我的视线中调用控制器以便它返回信息?

非常感谢你! ++

ps:对不起英语

0 个答案:

没有答案
相关问题