big_image);
if($big_width <= $max_width and $big_height <= $max_height) { $func_output($big_image, $new_name.$func_exname); return true; }
$ratiow = $max_width / $big_width;
$ratioh = $max_height / $big_height;
if($resize == 1) {
if($big_width >= $max_width and $big_height >= $max_height)
{
if($big_width > $big_height)
{
$tempx = $max_width / $ratioh;
$tempy = $big_height;
$srcX = ($big_width - $tempx) / 2;
$srcY = 0;
} else {
$tempy = $max_height / $ratiow;
$tempx = $big_width;
$srcY = ($big_height - $tempy) / 2;
$srcX = 0;
}
} else {
if($big_width > $big_height)
{
$tempx = $max_width;
$tempy = $big_height;
$srcX = ($big_width - $tempx) / 2;
$srcY = 0;
} else {
$tempy = $max_height;
$tempx = $big_width;
$srcY = ($big_height - $tempy) / 2;
$srcX = 0;
}
}
} else {
$srcX = 0;
$srcY = 0;
$tempx = $big_width;
$tempy = $big_height;
}
$new_width = ($ratiow > 1) ? $big_width : $max_width;
$new_height = ($ratioh > 1) ? $big_height : $max_height;
if(function_exists("imagecopyresampled"))
{
$temp_image = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($temp_image, $big_image, 0, 0, $srcX, $srcY, $new_width, $new_height, $tempx, $tempy);
} else {
$temp_image = imagecreate($new_width, $new_height);
imagecopyresized($temp_image, $big_image, 0, 0, $srcX, $srcY, $new_width, $new_height, $tempx, $tempy);
}
$func_output($temp_image, $new_name.$func_exname);
ImageDestroy($big_image);
ImageDestroy($temp_image);
return true;
}
?>