View file NuclearCMS_v.1.0.0/dl/prev.php

File size: 1.09Kb
<?php

include "sys/cons.php";
include "sys/cepumi.php";
include "sys/funct.php";
include "sys/lang/$language.php";
//include "sys/msg.php";

@$fails = $_GET["fails"];
@$h = parbaude($_GET["h"]);
@$w = parbaude($_GET["w"]);


if(preg_match("[http]",$fails)) exit("Kļūda!");
if(preg_match("[\.\.]",$fails)) exit("Kļūda!");
if(preg_match("[%]",$fails)) exit("Kļūda!");
if($h > 500 or $w > 500) {header ("Location: index.php?msg=bigwh&"); exit;}

if(preg_match("[\.png]",$fails) or preg_match("[\.PNG]",$fails)) {
$old = imagecreatefrompng("$fails"); 
} elseif(preg_match("[\.gif]",$fails) or preg_match("[\.GIF]",$fails)) {
$old = imagecreatefromgif("$fails"); 
} elseif(preg_match("[\.jpg]",$fails) or preg_match("[\.JPG]",$fails)) {
$old = imagecreatefromjpeg("$fails"); 
}
$weight = imageSX($old); 
$height = imageSY($old);
if($h) {
$wn = $w;
$hn = $h;
} else {
$wn = AUGSTUMS;
$hn = AUGSTUMS;
}
$new =  imagecreatetruecolor($wn, $hn);
imageCopyResized($new, $old, 0, 0, 0, 0, $wn, $hn, $weight, $height);
Header("Content-type: image/jpeg");
imagejpeg($new); 

?>