I don't have access to PHP v4, would please test this code: (add it at the top of images.php, below <?php)
//PHP 4.2.x Compatibility function
//http://php.net/manual/en/function.file-get-contents.php#80707
if (!function_exists('file_get_contents'))
{
function file_get_contents($filename, $incpath = false, $resource_context = null)
{
if (false === $fh = fopen($filename, 'rb', $incpath))
{
trigger_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING);
return false;
}
clearstatcache();
if ($fsize = @filesize($filename))
{
$data = fread($fh, $fsize);
}
else
{
$data = '';
while (!feof($fh))
{
$data .= fread($fh, 8192);
}
}
fclose($fh);
return $data;
}
}
//http://www.phpbuilder.com/board/showthread.php?t=10292234#post10721510
if (!function_exists('file_put_contents'))
{
// Define flags related to file_put_contents(), if necessary
if (!defined('FILE_USE_INCLUDE_PATH'))
define('FILE_USE_INCLUDE_PATH', 1);
if (!defined('FILE_APPEND'))
define('FILE_APPEND', 8);
function file_put_contents($filename, $data, $flags = 0)
{
// Handle single dimensional array data
if (is_array($data))
{
// Join the array elements
$data = implode('', $data);
}
// Flags should be an integral value
$flags = (int)$flags;
// Set the mode for fopen(), defaulting to 'wb'
$mode = ($flags & FILE_APPEND) ? 'ab' : 'wb';
$use_include_path = (bool)($flags & FILE_USE_INCLUDE_PATH);
// Open file with filename as a string
if ($fp = fopen("$filename", $mode, $use_include_path))
{
// Acquire exclusive lock if requested
if ($flags & LOCK_EX)
{
if (!flock($fp, LOCK_EX))
{
fclose($fp);
return false;
}
}
// Write the data as a string
$bytes = fwrite($fp, "$data");
// Release exclusive lock if it was acquired
if ($flags & LOCK_EX)
{
flock($fp, LOCK_UN);
}
fclose($fp);
return $bytes; // number of bytes written
}
return false;
}
}