Script stops without errors

See all posts Reply

Script stops without errors new!
by Robert, 12 years, 5 months ago
For some reason a script stops doing anything half way through. If you look at the following code you can see how I'm trying to see what is causing the stop.

// save uploaded image with a new name
$foo->file_new_name_body = $image_name;
$foo->Process($save_directory);
echo 'hi 1';
if ($foo->processed) {
  echo 'original image copied 1';
} else {
  echo 'error 1: ' . $foo->error;
}

/*
// save uploaded image with a new name,
// resized to 100px wide
$foo->file_new_name_body = $image_name . '_thumb';
$foo->image_resize = true;
$foo->image_convert = gif;
$foo->image_x = 138;
$foo->image_ratio_y = true;
$foo->file_overwrite = true;
$foo->Process($save_directory);
echo 'hi 2';
*/
          
// resized to 100px wide
echo '1';
$foo->file_new_name_body = $image_name . '_medium';
echo '2';
$foo->image_resize = true;
echo '3';
$foo->image_convert = jpg;
echo '4';
$foo->image_x = 300;
echo '5';
$foo->image_ratio_y = true;
echo '6';
$foo->file_overwrite = true;
echo '7';
$foo->Process($save_directory);
echo '8';
 
if ($foo->processed) {
  echo 'original image copied';
} else {
  echo 'error 2: ' . $foo->error;
}

Running the above code, the last thing I see is '7' printed to screen. The last $foo->Process doesn't run. I don't get '8' and that final error does nothing.

What would be causing this kind of behaviour?Reply
Re: Script stops without errors new!
by DodgyBob, 12 years, 5 months ago
This question has also been asked over at Stack Overflow. If it gets solved there first, you may want to copy the answer here (or vice versa). The link is stackoverflow.com/questions/7897820/what-would-cause-a-php-script-to-just-stop-without-reasonReply
Re: Script stops without errors new!
by Robert, 12 years, 5 months ago
Cheers dodgyBob... actually that is my post also :)

After much more debugging I was able to make the script execute by choosing a smaller image file.

The original image was 324kb in size, 2832 x 4256 and seems to be straight off a Nikon camera.

i tried changing the server memory limits by putting the following at the top of the script:

ini_set ( "memory_limit", "40M");

But this had no positive effect.

What do I need to do so that I can make this work again in the future?Reply
Re: Script stops without errors new!
by colin, 12 years, 5 months ago
You are running out of memory.

Search for memory in the site, or click here.

You can also check this post.Reply