Размер файла: 636B
<?php
function pic($name_big)
{
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($name_big);
$imagetip=getimagesize($name_big);
$w=40/$height*$width;
if ($w>80)
$w=80;
if ($imagetip[2]=="1")
$s_im=imagecreatefromgif($name_big);
if ($imagetip[2]=="2")
$s_im=imagecreatefromjpeg($name_big);
if ($imagetip[2]=="3")
$s_im=imagecreatefrompng($name_big);
$d_im=imagecreatetruecolor($w, 40);
imagecopyresampled($d_im, $s_im, 0, 0, 0, 0, $w, 40, $width, $height);
imagejpeg($d_im);
}
if (isset($_GET['id']))
{
pic($_GET['id']);
}
?>