Thread: Installing GD
View Single Post
Old 11-01-2007, 05:12 PM   #20 (permalink)
bluesaga
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

Ok please:

1) Add
PHP Code:

<?php
if( !function_exists('memory_get_usage') )
{
    function 
memory_get_usage()
    {
        
//If its Windows
        //Tested on Win XP Pro SP2. Should work on Win 2003 Server too
        //Doesn't work for 2000
        //If you need it to work for 2000 look at http://us2.php.net/manual/en/function.memory-get-usage.php#54642
        
if ( substr(PHP_OS,0,3) == 'WIN')
        {
               if ( 
substrPHP_OS0) == 'WIN' )
                {
                    
$output = array();
                    
exec'tasklist /FI "PID eq ' getmypid() . '" /FO LIST'$output );
       
                    return 
preg_replace'/[\D]/'''$output[5] ) * 1024;
                }
        }else
        {
            
//We now assume the OS is UNIX
            //Tested on Mac OS X 10.4.6 and Linux Red Hat Enterprise 4
            //This should work on most UNIX systems
            
$pid getmypid();
            
exec("ps -eo%mem,rss,pid | grep $pid"$output);
            
$output explode("  "$output[0]);
            
//rss is given in 1024 byte units
            
return $output[1] * 1024;
        }
    }
}
?>
To the top of your code, either in an include or at the very top (the IF statement requires that it is at the top)....

2) Before and After every image resize, use the function above and echo the output of it. This should give an indicator of where the problems within your script are.

Note: I mean the script you are using to run the class that resizes the image.
__________________
Halo 3 Cheats
bluesaga is offline  
Reply With Quote