The following self-contained example works fine for me in my environment. Try
it on yours, it may help to narrow the problem down further:
public function imgtestAction()
{
$this->_helper->layout->disableLayout();
$logo =
file_get_contents("http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png");
$type = 'image/png';
$response = $this->getFrontController()->getResponse();
$response->setHeader('Content-Type', $type, true);
$response->setHeader('Content-Length', count($logo), true);
$response->setHeader('Content-Transfer-Encoding', 'binary', true);
$response->setHeader('Cache-Control', 'max-age=3600, must-revalidate',
true);
$response->setBody($logo);
$response->sendResponse();
exit;
}
Michael Crumm wrote:
>
> Giuliano,
>
> Thanks for the thought! Unfortunately, I tried that as well and still
> can't
> seem to get an image out.
> Here's my controller action:
>
> public function viewAction()
> {
> $this->_helper->layout->disableLayout();
> $logo = $this->_logo;
> $modifiedDateGM = gmdate('D, d M Y H:i:s',
> strtotime($logo['modified'])) . ' GMT';
>
> $response = $this->getFrontController()->getResponse();
> $response->setHeader('Last-Modified', $modifiedDateGM, true);
> $response->setHeader('Content-Type', $logo['type'], true);
> $response->setHeader('Content-Length', $logo['size'], true);
> $response->setHeader('Content-Transfer-Encoding', 'binary', true);
> $response->setHeader('Cache-Control', 'max-age=3600,
> must-revalidate', true);
> $response->setBody($logo['data']);
> $response->sendResponse();
> exit;
> }
>
> Seems like someone over in the zf-db list was having a similar issue - I'm
> having a similar discussion over there.
>
> Any more thoughts?
>
> -Mike
>
>
--
View this message in context:
http://www.nabble.com/Outputting-an-image-tp20132978p20159334.html
Sent from the Zend Framework mailing list archive at Nabble.com.