Файл: fo/pages/img.php
Строк: 63
<?php
$time=time();
if(!empty($_GET['s']))$size = intval(abs($_GET['s']));
if($size!=1 and $size!=2 and $size!=3 and $size!=4)$size = '3';
if($size == 1){
$neww=130;
$newh=130;
}
if($size == 2){
$neww=132;
$newh=176;
}
if($size == 3){
$neww=176;
$newh=220;
}
if($size == 4){
$neww=240;
$newh=320;
}
if(!$neww or !$newh)
{
$neww=intval(@$_POST['x']);
$newh=intval(@$_POST['y']);
}
if(!$neww or !$newh)
exit;
$pr=intval(@$_POST['pr']);
if(!$pr)
$pr=intval(@$_GET['pr']);
if($neww>1600 or $neww<1)
$neww=130;
if($neww>1600 or $neww<1)
$neww=130;
$id=intval($_GET['id']);
$f=mysql_fetch_array(mysql_query("select * from files where id=".$id));
mysql_query("update `files` set `downloads` = `downloads` + 1, `last_download` = '".time()."' where `id`='$id';");
$file=htmlspecialchars($f['filename']);
if(substr($file, 0,6)=='files/')
{
list($sx,$sy, $type,)=@getimagesize($file);
$sxy=round($sx/$sy,3);
$swh=round($neww/$newh,3);
if(!$pr)
{
if($sxy<$swh)
$neww=intval($newh*$sxy);
else
$newh=intval($neww/$sxy);
}
//print "$sxy $swh";
//print "$neww $newh $sx $sy";
if ($type==1) {$funci='imagecreatefromgif';} //$funco="imagegif";}
if ($type==2) {$funci='imagecreatefromjpeg';} //$funco="imagejpeg";}
if ($type==3) {$funci='imagecreatefrompng';} //$funco="imagepng";}
if($type)
{
$im1 = @$funci($file);
$im2=@imagecreatetruecolor($neww,$newh);
@imagecopyresized($im2, $im1, 0,0,0,0,$neww,$newh, @imagesx($im1), @imagesy($im1));
@header('Content-type: image/gif');@imagegif($im2);}
}
?>