Размер файла: 831B
<?
if (!isset($_GET['ico'])||$_GET['ico']==''){
exit;
}else{
$ico=intval($_GET['ico']);
}
$size = GetImageSize("ico/$ico.png");
$width = $size[0];
$height = $size[1];
$x_ratio = 16 / $width;
$y_ratio = 16 / $height;
if ( ($width <= 16) && ($height <= 16) ){$tn_width = $width; $tn_height = $height; }
else if (($x_ratio * $height) < 16) { $tn_height = ceil($x_ratio * $height); $tn_width = 16; }
else {$tn_width = ceil($y_ratio * $width); $tn_height = 16;}
$src = ImageCreateFromPng("ico/$ico.png");
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width,$tn_height,$width,$height);
imagecolortransparent($dst, '0');
header("Content-type: image/png");
if ($width>16 || $height>16){
ImagePng ($dst);
imagedestroy($dst);
}else{
ImagePng ($src);
imagedestroy($src);}
?>