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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.