Skip to content

Instantly share code, notes, and snippets.

@wowo
Created January 8, 2010 13:04
Show Gist options
  • Save wowo/272036 to your computer and use it in GitHub Desktop.
Save wowo/272036 to your computer and use it in GitHub Desktop.
<?php
class dummyActions extends sfActions
{
/**
* remember: never use readfile function here! it sends headers to browser, so those sent by you are useles
* also don't echo file and then return sfView::NONE - echoing should be done in views!
*
* this method is environment independent, you can use it in _prod, _dev etc,
* alsoWeb Debug Toolbar can be turned on
*/
public function executeShowPictureInBrowser(sfWebRequest $request)
{
$filepath = '/tmp/photo.jpg';
$this->getResponse()->setContentType('image/jpeg');
return $this->renderText(file_get_contents($filepath));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment