function image_resize(&$s, $dx, $dy) {
set_time_limit(300);
$sx = imagesx($s);
$sy = imagesy($s);
$r = min(($sx / $dx), ($sy / $dy));
$a = round(($sx - $dx * $r) / 2);
$b = round(($sy - $dy * $r) / 2);
$d = @imagecreatetruecolor($dx, $dy);
@imagecopyresampled($d, $s, 0, 0, $a, $b, $dx, $dy, ($sx - $a * 2), ($sy - $b * 2));
@imageinterlace($d, 1);
return $d;
}
