Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-24-2008, 01:33 PM
Junior Member
 
Join Date: Apr 2008
Posts: 2
Default "Clean" Action Output?

Hi -

public function indexAction() {
...
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->getResponse()->renderExceptions(true);
$this->getResponse()->setHeader('Content-Type', 'image/jpeg');
$this->getResponse()->setBody($myobject->imageBlob);
$this->getResponse()->sendResponse();
}

I'm trying to return a binary image stream as the result of my action. I see the image data, but it has two characters prepended on the front of the data.

I can get the same database/data to work when I have a simple .php file retrieve the data from the database and return it, but when I do it as an action, there is still some stuff being injected at the front that I can't seem to turn off...

Any ideas?

Thanks!

Tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-24-2008, 02:17 PM
Elemental's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 119
Default

Not that your way won't work, but what I have done in my apps is make the view script echo out the header and image Blob data. The controller gets it and assigns it to the view and the view script is returned as an image.
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk
Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-24-2008, 03:53 PM
Junior Member
 
Join Date: Apr 2008
Posts: 2
Default

Hmm, that's actually what I tried originally:


$this->_helper->layout->disableLayout();
$this->getResponse()->setHeader('Content-Type', 'image/jpeg');

And then:

<?php echo $this->myobject->myblob ?>

I see the data, but it still has extra stuff on it.

Tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:36 AM.