function resize ($filename, $size)
{
$pref = 'mini_';
$formats = array('.jpg', '.gif', '.png', '.bmp'); {
$new_height = $height * $size;
$new_width = $new_height / $width;
switch ($img)
{
//создаем превьюшки
}
imagecopyresized($thumb, $source, 0, 0, 0, 0, $size, $new_width, $width, $height); switch ($img)
{
case '.jpg': imagejpeg($thumb, $pref.$imgname); break; case '.gif': imagegif($thumb, $pref.$imgname); break; case '.png': imagepng($thumb, $pref.$imgname); break; case '.bmp': imagewbmp($thumb, $pref.$imgname); break; }
}
else return 'Error';
return $imgname;
}