$postval){ ${$postvar} = $postval; }
foreach($_GET as $getvar => $getval){ ${$getvar} = $getval; }
/***** Yoxlamalar ****/
$msg_all="P.S. Bu sistemin dırkası deyil. Əgər dırkadırsa, saytı onunla hack etmək olar. Bu sadəcə səhv nəticədir. Əgər yenədə bunu dırka hesab edən varsa buyurun qırın. ";
$msg_all="";
if(empty($yol))
{
echo "
Şəkil parametri göndərilməmişdir!
{$msg_all}";
die();
}
require("eladmin/sinif.php");
$elco=new class_elshad100;
$param_str=$elco->decode($yol);
if(strpos($param_str,"::")===false) {
echo "Şəkil parametri yanlış formatdadır!
{$msg_all}";
die();
}
/*
if(!file_exists($yol))
{
echo "Şəkil tapılmadı!
{$msg_all}";
die();
}
*/
/***** END OF Yoxlamalar ****/
// Content type
header('Content-type: image/jpeg');
// cache-de sekili saxlamaq
$cache_foto='cache/'.md5($yol).'.jpg';
if(file_exists($cache_foto))
{
$stream = fopen($cache_foto,'r');
$foto_fayl=stream_get_contents($stream);
echo $foto_fayl;
exit();
}
else
{
/*
$watermark_path_small='img/axsam_water_small.png';
$watermark_path_normal='img/axsam_water.png';
$watermark_path_orta='img/axsam_water_orta.png';
$watermark_path_big='img/axsam_water_big.png';
$watermark_path_small='img/axsam_logo_2018_wsmall4.png';
$watermark_path_normal='img/axsam_logo_2018_w4.png';
$watermark_path_orta='img/axsam_logo_2018_worta4.png';
$watermark_path_big='img/axsam_logo_2018_wbig3.png';
*/
$watermark_path_small='img/axsam_water2019_small.png';
$watermark_path_normal='img/axsam_water2019_small.png';
$watermark_path_orta='img/axsam_water2019.png';
$watermark_path_big='img/axsam_water2019.png';
list($sekilPath,$maxwidth,$maxheight,$sifrele)=explode("::",$param_str);
if(!file_exists($sekilPath))
{
echo "Şəkil tapılmadı!
{$msg_all}";
die();
}
//echo "
sekilPath=$sekilPath
maxwidth=$maxwidth
maxheight=$maxheight
sifrele=$sifrele
";
$filename =$sekilPath;
list($width, $height) = getimagesize($filename);
if($sifrele=='qoru')
{
if($maxwidth>1000 && $width>1000) $watermark_path=$watermark_path_orta; elseif($maxwidth>370) $watermark_path=$watermark_path_normal;
else $watermark_path=$watermark_path_small;
}
//$maxheight=450;
//$maxwidth=600;
if ($maxwidth < 0 || $maxheight < 0){
$newheight=$width;
$newheight=$height; }
if ($maxwidth <= 10 && $maxheight <= 10) {
$newwidth = $width * $maxwidth;
$newheight = $height * $maxheight;
} else if ($width > $maxwidth || $height > $maxheight) {
if ($width / $height > $maxwidth / $maxheight) {
$newwidth = $maxwidth;
$newheight = $height * $newwidth / $width;
} else {
$newheight = $maxheight;
$newwidth = $width * $newheight / $height;
}
} else if ($width <= $maxwidth) {
$newwidth = $width;
$newheight = $height;
}
else {
return $filename;
}
// Load
$thumb= imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
// Resize
//imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
if($sifrele=='qoru')
{
// creating png image of watermark
$watermark = imagecreatefrompng($watermark_path);
// getting dimensions of watermark image
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
//$dest_x = $newwidth - $watermark_width - 0;
//$dest_y = $newheight - $watermark_height - 20;
$dest_x = 0;
$dest_y = round($newheight/20);
imagealphablending($source, true);
imagealphablending($watermark, true);
imagecopy($thumb, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);
}
// Output
imagejpeg($thumb,$cache_foto);
imagejpeg($thumb);
}
?>