Jump to content

ob_start(); problem on linux


dodgy

Recommended Posts

I have the following problem. I open up an image to edit and ones I finish editing the image I delete the original and what to save the edited image directly to a mysql database, but "imagejpeg()" only gives me the options to save to a file or output to the browser. So  I output it to the browser but catch the output as follows

 

// Apparently there is a problem with apache that change the script directory so you have to change it back with the following function
function callback ($string)
{
  chdir(dirname($_SERVER['SCRIPT_FILENAME']));
  return $string;
}
ob_start("callback");
imagejpeg($image_resized, NULL, 75);

// This string a can save to the insert into my db
$image_string = addslashes(ob_get_contents());
$ob_end_clean;

 

The code above works perfectly with WAMP but when i use it in a linux/apache invironment, the code brakes at the ob_start() function but no errors are displayed(Error reporting is on and set to E_ALL)

Can any one make a suggestion to what may be the wrong. It seems as if the call back functions doesn't work ie. the script directory is till incorrect!!

Thanks

Link to comment
https://forums.phpfreaks.com/topic/79552-ob_start-problem-on-linux/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.