• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cannot modify headers bug?

Hello, I keep getting the following error / warning

ERROR - 2012-06-24 20:16:07 --> Severity: Warning  --> Cannot modify header information - headers already sent by (output started at /home/user/public_html/html_project/system/application/models/admin_model.php:173) /home/user/public_html/html_project/system/core/Output.php 92

line 173 of admin_model is:


Should I not be using that?


It looks like you create an error with the second argument you provide for imagejpg. I think what you need to know (from the PHP Doc)

The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.

To skip this argument in order to provide the quality parameter, use NULL.

Try setting the second parameter to NULL and see what happens^^

nope, it still does it D:

This started after I added to the admin controller construct:

$this->output->set_header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
$this->output->set_header("Pragma: no-cache");

I was having issues in IE not reloading any changes made in the admin panel so I needed to add the above. I'm not sure how to fix this :\

still happening D:

here is the entire function that is causing the warning

public function slideshow_thumb($img, $maxDim, $location)
  $location = str_replace('-', '/', $location);
  list($curImgW, $curImgH) = getimagesize('images/'.$location.'/'.$img);

  if($curImgH > $curImgW)
   $dif = $maxDim/$curImgH;
   $newH = $maxDim;
   $newW = floor($curImgW*$dif);
   $dif = $maxDim/$curImgW;
   $newW = $maxDim;
   $newH = floor($curImgH*$dif);

  $startImg = imagecreatefromjpeg('images/'.$location.'/'.$img);
  $image = imagecreatetruecolor($newW, $newH);

  imagecopyresampled($image, $startImg, 0, 0, 0, 0, $newW, $newH, $curImgW, $curImgH);
  imagejpeg($image, NULL, 80);


sorry, bump! anyone?

The problem could probably be that you are outputting the image (via imagejpeg) before the headers are sent along with the rest of the final output from the controller. Try returning your image and outputting it from your controller with the rest of your data so it gets buffered with the rest of the content.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.