Skip to content

Commit

Permalink
Merge pull request #23 from Flyingmana/Flyingmana-patch-1
Browse files Browse the repository at this point in the history
prevent HEADERS ALREADY SENT error
  • Loading branch information
colinmollenhour authored Oct 25, 2016
2 parents c7cf38b + 634ec5c commit b754092
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@ public function thumbnailAction()
$file = Mage::helper('cms/wysiwyg_images')->idDecode($file);
$thumb = $this->getStorage()->resizeOnTheFly($file);
if ($thumb !== false) {
ob_start();
$image = Varien_Image_Adapter::factory('GD2');
$image->open($thumb);
$image->display();
$this->getResponse()->setHeader('Content-type', $image->getMimeType(), true);
$this->getResponse()->setBody(ob_get_clean());
} else {
// todo: genearte some placeholder
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function directiveAction()
$directive = $this->getRequest()->getParam('___directive');
$directive = Mage::helper('core')->urlDecode($directive);
$url = Mage::getModel('cms/adminhtml_template_filter')->filter($directive);
ob_start();
try {
$image = Varien_Image_Adapter::factory('GD2');
$image->open($url);
Expand All @@ -62,6 +63,8 @@ public function directiveAction()
imagedestroy($image);
*/
}
$this->getResponse()->setHeader('Content-type', $image->getMimeType(), true);
$this->getResponse()->setBody(ob_get_clean());
}

/**
Expand Down

0 comments on commit b754092

Please sign in to comment.