<?


if (is_file(H."files/user_files/screens_litle/$file_id[id].png"))
{

echo "<img src='/files/user_files/screens_litle/$file_id[id].png' alt='Скрин...' />\n";
}
elseif (function_exists('imagecreatefromstring'))
{

$imgc=imagecreatefromstring(file_get_contents($file));
$img_x=imagesx($imgc);
$img_y=imagesy($imgc);
if ($img_x==$img_y)
{
$dstW=80; // ширина
$dstH=80; // высота 
}
elseif ($img_x>$img_y)
{
$prop=$img_x/$img_y;
$dstW=80;
$dstH=ceil($dstW/$prop);
}
else
{
$prop=$img_y/$img_x;
$dstH=80;
$dstW=ceil($dstH/$prop);
}

$screen=imagecreatetruecolor($dstW, $dstH);
$black = imagecolorallocate ($screen, 0, 0, 0);
imagecolortransparent($screen,$black);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($imgc);
imagepng($screen,H."files/user_files/screens_litle/$file_id[id].png");
imagedestroy($screen);
echo "<img src='/files/user_files/screens_litle/$file_id[id].png' alt='Скрин...' />\n";
}

?>