<?php
header("cache-control: public");
header("content-type: image/jpeg");
$cfg.=".cfg";
$cfg_txt=file("./".$cfg, "r");
for($i=0; $i<count($cfg_txt); $i++)
{
$param=explode("=", $cfg_txt[$i]);
$GLOBALS[ trim($param[0]) ]=trim($param[1]);
}
$cfgtime=filemtime("./".$cfg) or die("error cfg opening!");
$im1time=filemtime($img_path.$img) or die("error img opening!");
$im2time=filemtime($img_path.$cfg."/".$img);
$htime=date("D, d M Y H:i:s", $im2time)." GMT";
if ($im2time)
{
header("Last-Modified: ".$htime);
header("Created: ".$htime);
}
if(( !$im2time) or ($cfgtime>$im2time) or ($im1time>$im2time))
{
$imageinfo=getimagesize ( $img_path.$img);
switch($imageinfo[2])
{
case 1: echo "<b>gif - not supported!</b>"; break; #GIF,
case 2: $im1=imagecreatefromjpeg($img_path.$img); break; #JPG,
case 3: $im1=imagecreatefrompng($img_path.$img); break; #PNG,
case 4: echo "<b>swf - not supported!</b>"; break;#SWF,
case 5: echo "<b>psd - not supported!</b>"; break;#PSD,
case 6: $im1=imagecreatefromwbmp($img_path.$img); break; #BMP,
case 7: $im1=imagecreatefromtiff($img_path.$img); break; #TIFF(intel byte order),
case 8: echo "<b>TIFF(motorola byte order) - not supported!</b>"; break;#TIFF(motorola byte order)
case 9: echo "<b>JPC - not supported!</b>"; break;#JPC,
case 10: echo "<b>JP2 - not supported!</b>"; break;#JP2,
case 11: echo "<b>JPX - not supported!</b>"; break;#JPX
default:
}
# im1 - сюы╧╟р═ ърЁ╙шэър;
$w1=$imageinfo[0];
$h1=$imageinfo[1];
$x1=0;
$y1=0;
# ╓╙ю хх ЁрчьхЁ?
#╒╙ю-╙ю ё╒ш╙рхь.......
if ($holdxy=="no")
{
$x2=1;
$y2=1;
$w2=$targetx;
$h2=$targety;
}
else
{
resize_src();
}
$im2=imagecreatetruecolor ($w1, $h1);
imagecopy( $im2, $im1, 0, 0, $x1, $y1, $w1, $h1);
imagedestroy($im1);
$im3=imagecreatetruecolor ($w2-1, $h2-1);
ImageCopyResized($im3, $im1, 0, 0, 1, 1, $targetx, $targety, 1, 1);
imagecopyresampled ( $im3, $im2, 0, 0, 0, 0, $w2, $h2 , $w1, $h1);
@mkdir($img_path.$cfg);
imagejpeg($im3, $img_path.$cfg."/".$img, $quality);
}
readfile ($img_path.$cfg."/".$img);
?>