View file www/img.php

File size: 1.88Kb
<?php
#-----------------------------------------------------#
#          ********* Бизнес Сайты *********           #
#             Made by   :  BIZON                      #
#               E-mail  :  [email protected]            #
#                 Site  :  http://f913218p.bget.ru    #
#  Вы не имеете право вносить изменения в код скрипта #
#      это может повлечь неработоспособность сайта    #
#-----------------------------------------------------#
if(isset($_GET['url'])){
$st = htmlspecialchars($_GET['url']);
$st = stripslashes(trim($st));

if (isset($_GET['small']))
$small=(int)($_GET['small']);
else
$small=0;

$width=(int)($_GET['w']);
$height=(int)($_GET['h']);
$filename = $st;
$type = getimagesize($filename);
switch ($type['mime']) {
         case "image/jpeg":
         $fi=$filename;
         header('Content-Type: image/jpeg');
         $image = imageCreateFromJPEG($filename);
         break;

         case "image/gif":
         $fi=$filename;
         header('Content-Type: image/gif');
         $image = imageCreateFromGIF($filename);
         break;

         case "image/png":
         $fi=$filename;
         header('Content-Type: image/png');
         $image = imageCreateFromPNG($filename);
         break;

         default:
         }
if($small!=0){
$scr_img=$image;
$size = GetImageSize($filename);
$scr_width = $size[1];
$scr_height = $size[0];
$dest_width = $small;
$dest_height = ($dest_width/$scr_width) * $scr_height;
if($dest_height<100)$dest_height=100;
$image_p=ImageCreateTrueColor($dest_height,$dest_width);
ImageCopyResampled($image_p, $scr_img, 0, 0, 0, 0,$dest_height,$dest_width,$scr_height,$scr_width);
}
switch ($type['mime']) {
      case "image/jpeg":
      imagejpeg($image_p);
      break;

      case "image/gif":
      imagegif($image_p);
      break;

      case "image/png":
      imagepng($image_p);
      break;

      default:
      }
ImageDestroy($image_p);
}
?>