';
++$i;
}
} else {
echo '';
}
echo '
' . $lng['total'] . ': ' . $total . '
' . functions::display_pagination('index.php?id=' . $id . '&', $start, $total, $kmess) . '
';
}
if ($rights >= 6) {
echo "
";
break;
case 'al':
/*
-----------------------------------------------------------------
Просмотр альбома
-----------------------------------------------------------------
*/
$delimag = opendir("temp");
while ($imd = readdir($delimag)) {
if ($imd != "." && $imd != ".." && $imd != "index.php") {
$im[] = $imd;
}
}
closedir($delimag);
$totalim = count($im);
for ($imi = 0; $imi < $totalim; $imi++) {
$filtime[$imi] = filemtime("temp/$im[$imi]");
$tim = time();
$ftime1 = $tim - 10;
if ($filtime[$imi] < $ftime1) {
}
}
$rz = mysql_query("select * from `gallery` where type='rz' and id='" . $ms['refid'] . "';");
$rz1 = mysql_fetch_array($rz);
echo '
';
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `type` = 'ft' AND `refid` = '$id'"), 0);
$req = mysql_query("SELECT * FROM `gallery` WHERE `type` = 'ft' AND `refid` = '$id' ORDER BY `time` DESC LIMIT $start, $kmess");
while ($fot1 = mysql_fetch_array($req)) {
echo $i % 2 ? '
' : '
';
if(file_exists('foto/' . $fot1['name'])){
echo '
';
$infile = "foto/$fot1[name]";
if (!empty($_SESSION['frazm'])) {
$razm = $_SESSION['frazm'];
} else {
$razm = 50;
}
$sizs = GetImageSize($infile);
$width = $sizs[0];
$height = $sizs[1];
$quality = 80;
$x_ratio = $razm / $width;
$y_ratio = $razm / $height;
if (($width <= $razm) && ($height <= $razm)) {
$tn_width = $width;
$tn_height = $height;
} else if (($x_ratio * $height) < $razm) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $razm;
} else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $razm;
}
$format = functions::format($infile);
switch ($format) {
case "gif":
$im = ImageCreateFromGIF($infile);
break;
case "jpg":
$im = ImageCreateFromJPEG($infile);
break;
case "jpeg":
$im = ImageCreateFromJPEG($infile);
break;
case "png":
$im = ImageCreateFromPNG($infile);
break;
}
$im1 = imagecreatetruecolor($tn_width, $tn_height);
$namefile = "$fot1[name]";
imagecopyresized($im1, $im, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
switch ($format) {
case "gif":
$imagnam = "temp/$namefile.temp.gif";
ImageGif($im1, $imagnam, $quality);
echo "
";
break;
case "jpg":
$imagnam = "temp/$namefile.temp.jpg";
imageJpeg($im1, $imagnam, $quality);
echo "
";
break;
case "jpeg":
$imagnam = "temp/$namefile.temp.jpg";
imageJpeg($im1, $imagnam, $quality);
echo "
";
break;
case "png":
$imagnam = "temp/$namefile.temp.png";
imagePng($im1, $imagnam, $quality);
echo "
";
break;
}
imagedestroy($im);
imagedestroy($im1);
$fotsz = filesize("foto/$ms[name]");
$vrf = $fot1['time'] + $set_user['sdvig'] * 3600;
$vrf1 = date("d.m.y / H:i", $vrf);
echo '';
if (!empty($fot1['text']))
echo "$fot1[text]
";
if ($rights >= 6) {
echo "
" . $lng['edit'] . " |
" . $lng['delete'] . "";
}
} else {
echo $lng_gal['image_missing'] . '
' . $lng['delete'] . '';
}
echo "
";
++$i;
}
echo '
' . $lng['total'] . ': ' . $total . '
';
if ($total > $kmess) {
echo '
' . functions::display_pagination('index.php?id=' . $id . '&', $start, $total, $kmess) . '
' .
'
';
}
if (($user_id && $rz1['user'] == 1 && $ms['text'] == $login && !$ban['1'] && !$ban['14']) || $rights >= 6) {
echo '
' . $lng_gal['upload_photo'] . '';
}
if ($rights >= 6) {
echo "
" . $lng_gal['delete_album'] . "";
echo "
" . $lng_gal['edit_album'] . "";
}
echo "
" . $lng_gal['to_gallery'] . "";
break;
case 'ft':
/*
-----------------------------------------------------------------
Просмотр фото
-----------------------------------------------------------------
*/
echo "
";
$infile = "foto/$ms[name]";
if (!empty($_SESSION['frazm'])) {
$razm = $_SESSION['frazm'];
} else {
$razm = 50;
}
$sizs = GetImageSize($infile);
$width = $sizs[0];
$height = $sizs[1];
$quality = 85;
$format = functions::format($infile);
switch ($format) {
case "gif":
$im = ImageCreateFromGIF($infile);
break;
case "jpg":
$im = ImageCreateFromJPEG($infile);
break;
case "jpeg":
$im = ImageCreateFromJPEG($infile);
break;
case "png":
$im = ImageCreateFromPNG($infile);
break;
}
$im1 = imagecreatetruecolor($width, $height);
$namefile = "$ms[name]";
imagecopy($im1, $im, 0, 0, 0, 0, $width, $height);
switch ($format) {
case "gif":
$imagnam = "temp/$namefile.gif";
ImageGif($im1, $imagnam, $quality);
echo "
";
break;
case "jpg":
$imagnam = "temp/$namefile.jpg";
imageJpeg($im1, $imagnam, $quality);
echo "
";
break;
case "jpeg":
$imagnam = "temp/$namefile.jpg";
imageJpeg($im1, $imagnam, $quality);
echo "
";
break;
case "png":
$imagnam = "temp/$namefile.png";
imagePng($im1, $imagnam, $quality);
echo "
";
break;
}
imagedestroy($im);
imagedestroy($im1);
$fotsz = filesize("foto/$ms[name]");
$fotsz = round($fotsz / 1024, 2);
$sizs = GetImageSize("foto/$ms[name]");
$fwidth = $sizs[0];
$fheight = $sizs[1];
$vrf = $ms[time] + $set_user['sdvig'] * 3600;
$vrf1 = date("d.m.y / H:i", $vrf);
echo "
" . $lng['description'] . ": $ms[text]
";
echo $lng_gal['dimensions'] . ": $fwidth*$fheight пкс.
";
echo $lng_gal['weight'] . ": $fotsz кб.
";
echo $lng['date'] . ": $vrf1
";
echo $lng_gal['posted_by'] . ": $ms[avtor]
";
echo "" . $lng['download'] . "
";
echo "" . $lng['back'] . "
";
echo "" . $lng_gal['to_gallery'] . "
";
break;
default :
header("location: index.php");
break;
}
} else {
/*
-----------------------------------------------------------------
Главная страница Галлереи
-----------------------------------------------------------------
*/
echo '
' . $lng_gal['new_photo'] . ' (' . functions::stat_gallery(1) . ')
';
echo '
' . $lng['gallery'] . '
';
$req = mysql_query("SELECT * FROM `gallery` WHERE `type` = 'rz'");
$total = mysql_num_rows($req);
while ($res = mysql_fetch_assoc($req)) {
echo $i % 2 ? '
' : '
';
$al = mysql_query("select * from `gallery` where type='al' and refid='" . $res['id'] . "'");
$countal = mysql_num_rows($al);
echo '
' . $res['text'] . ' (' . $countal . ')
';
++$i;
}
echo '
' . $lng['total'] . ': ' . $total . '
';
if ($rights >= 6) {
echo "" . $lng_gal['create_section'] . "
";
}
echo "
";
}
}
require('../incfiles/end.php');
?>