Показать сообщение отдельно
Старый 22.10.2005, 03:02
ilzhan вне форума Посмотреть профиль Отправить личное сообщение для ilzhan Найти все сообщения от ilzhan
  № 5  
Ответить с цитированием
ilzhan
 
Аватар для ilzhan

Регистрация: Jul 2005
Адрес: Ufa
Сообщений: 30
Отправить сообщение для ilzhan с помощью ICQ
PHP код:
$type=false;
if(isset(
$_GET["file"])&&!empty($_GET["file"])){
list(
$width$height,$type) = getimagesize($_GET["file"]);
if(isset(
$_GET["width"],$_GET["height"])&&is_numeric($_GET["width"])&&is_numeric($_GET["height"])){
    
$newwidth=$_GET["width"];
    
$newheight=$_GET["height"];
    }else{
$newwidth 180;
$newheight $height / ($width/180);
}
if(
$type)
   switch (
$type){
       case 
1:$source imagecreatefromgif($_GET["file"]);
    break;
       case 
2:$source imagecreatefromjpeg($_GET["file"]);
    break;
       case 
3:$source imagecreatefrompng($_GET["file"]);
    break;
   }
if (
$newwidth<=$width){
if(
$type==2)$thumb imagecreatetruecolor($newwidth$newheight);else
$thumb imagecreate($newwidth$newheight);
imagealphablending($thumbfalse);
imagecopyresampled($thumb,$source,0,0,0,0,$newwidth,$newheight,$width,$height);
}else 
$thumb=$source;
   switch (
$type){
   case 
1:
     
header("Content-type: image/gif");
     
imagegif($thumb);
   break;
   case 
2:
     
header("Content-type: image/jpeg");
     
imagejpeg($thumb);
   break;
   case 
3:
     
header("Content-type: image/png");
     
imagepng($thumb);
   break;
   }