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


On Fri, Oct 24, 2008 at 8:29 AM, Giuliano Riccio
<[EMAIL PROTECTED]>wrote:

>
> Did you try with $this->getResponse()->setBody($image['data']); ?
> I don't know if it will work but maybe will do the trick :)
>
> Giuliano
>
> Michael Crumm wrote:
> >
> > Hello all,
> > I seem to be unable to output an image to the browser via a zf controller
> > action.  relevent code follows.
> >
> > public function viewAction()
> > {
> >     $this->_helper->layout->disableLayout();
> >   $this->_helper->ViewRenderer->setNoRender();
> >   if (!$id = $this->_getParam('id', false)) {
> >   return $this->_helper->redirector('index');
> >     }
> >
> >     $model = $this->getModel();
> >   $image = $model->get($id);
> >
> >     $this->_response->setHeader('Content-Type', 'image/jpeg', true);
> >   echo $image['data'];
> > }
> >
> > As you can see, when the action is called (with a valid id parameter), i
> > just want the browser to spit out the image.  Instead, i'm getting no
> > output
> > at all.
> >
> > I have using readfile() and pointing to a absolute filesystem path as
> > well,
> > also with no luck.
> >
> > The data appears to be downloading - firebug shows the actual image sizes
> > being downloaded
> >
> >
> > Does anyone have any thoughts?
> >
> > Michael Crumm
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Outputting-an-image-tp20132978p20150164.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to