File size: 8.35Kb
<?
if (isset($_GET['act']) && $_GET['act'] == 'rename')
{
if(isset($_GET['rotate']) && ($_GET['rotate'] == 'right' || $_GET['rotate'] == 'left') && is_file(H.'sys/gallery/foto/'.$foto['id'].'.'.$foto['ras'].'') && is_file(H.'sys/gallery/640/'.$foto['id'].'.'.$foto['ras'].'') && is_file(H.'sys/gallery/128/'.$foto['id'].'.'.$foto['ras'].'') && is_file(H.'sys/gallery/50/'.$foto['id'].'.'.$foto['ras'].''))
{
$rotate=$_GET['rotate'];
if($rotate == 'left')
$degrees = 90;
else
$degrees = 270;
// Файл и угол поворота
$icon50 = H.'sys/gallery/50/'.$foto['id'].'.'.$foto['ras'].'';
$icon128 = H.'sys/gallery/128/'.$foto['id'].'.'.$foto['ras'].'';
$icon640 = H.'sys/gallery/640/'.$foto['id'].'.'.$foto['ras'].'';
$icon0 = H.'sys/gallery/foto/'.$foto['id'].'.'.$foto['ras'].'';
// Загрузка изображения
$source0 = imagecreatefromstring(file_get_contents($icon0));
$source640 = imagecreatefromstring(file_get_contents($icon640));
$source128 = imagecreatefromstring(file_get_contents($icon128));
$source50 = imagecreatefromstring(file_get_contents($icon50));
// Поворот
$rotate50 = imagerotate($source50, $degrees, 0);
$rotate128 = imagerotate($source128, $degrees, 0);
$rotate640 = imagerotate($source640, $degrees, 0);
$rotate0 = imagerotate($source0, $degrees, 0);
// Ввод
if (is_file(H.'sys/gallery/50/'.$foto['id'].'.'.$foto['ras'].''))unlink(H.'sys/gallery/50/'.$foto['id'].'.'.$foto['ras'].'');
imagejpeg($rotate50, H.'sys/gallery/50/'.$foto['id'].'.'.$foto['ras'].'');
if (is_file(H.'sys/gallery/128/'.$foto['id'].'.'.$foto['ras'].''))unlink(H.'sys/gallery/128/'.$foto['id'].'.'.$foto['ras'].'');
imagejpeg($rotate128, H.'sys/gallery/128/'.$foto['id'].'.'.$foto['ras'].'');
if (is_file(H.'sys/gallery/640/'.$foto['id'].'.'.$foto['ras'].''))unlink(H.'sys/gallery/640/'.$foto['id'].'.'.$foto['ras'].'');
imagejpeg($rotate640,H.'sys/gallery/640/'.$foto['id'].'.'.$foto['ras'].'');
if (is_file(H.'sys/gallery/foto/'.$foto['id'].'.'.$foto['ras'].''))unlink(H.'sys/gallery/foto/'.$foto['id'].'.'.$foto['ras'].'');
imagejpeg($rotate0,H.'sys/gallery/foto/'.$foto['id'].'.'.$foto['ras'].'');
header("Location: ?act=rename".SID);
exit;
}
?>
<link rel="stylesheet" href="/foto/style/style-foto.css" type="text/css" />
<div class="foto_head_bg">
<div class="lc_br wbg font0 relative oh" id="header_path">
<a href="/" style="font-size:0;"> <img src="/foto/style/ico/home.png" alt=""> </a>
<span class="lc_brw">
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <a href="/info.php?id=<?= $ank['id']?>"><?= $ank['nick']?></a>
</span>
<span class="lc_brw">
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <a href="/foto/<?= $ank['id']?>/">Фото</a>
</span>
<span class="lc_brw">
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">Редактируем фото <?= text($foto['name'])?></span>
</span>
</div>
<form action="?act=rename&ok" method="post">
<div class="wrapper">
<div class="block grey t_center">
<div class="image_limit"> <span class="pr"> <div class="inl_bl relative">
<img src="/foto/foto640/<?= $foto['id']?>.<?= $foto['ras']?>" alt="" class="preview">
</div> </span> </div>
<div class="pad_t_a"> Вы можете повернуть фото, если оно отображается неправильно: </div>
</div>
<table class="table__wrap table__links bord-top"> <tbody><tr>
<td class="table__cell" width="50%">
<!-- --><!-- --><!-- --><!-- -->
<a class=" link full is_final " id="turn_left" href="?act=rename&rotate=left">
<img src="/foto/style/ico/rotate_left.png" alt="" class="m"> <span class="m">Влево</span><!-- -->
</a>
<!-- --><!-- -->
</td>
<td class="table__cell table__cell_last" width="50%">
<!-- --><!-- --><!-- --><!-- -->
<a class=" link full is_final " id="turn_right" href="?act=rename&rotate=right">
<img src="/foto/style/ico/rotate_right.png" alt="" class="m"> <span class="m">Вправо</span><!-- -->
</a>
<!-- --><!-- -->
</td>
</tr> </tbody></table>
</div>
<div class="wrapper">
<div class="block pdb">
<div>
<label class="lbl"> Имя файла: </label>
<table class="table__wrap"> <tbody><tr>
<td width="100%">
<div class="input-txt_wrapper"> <input class="input-txt" name="name" value="<?= text($foto['name'])?>" maxlength="50" type="text"> </div>
</td>
<td class="m lgrey3"> .<?= $foto['ras']?> </td>
</tr>
</tbody></table>
</div>
<div class="pad_t_a">
<div>
<label class="lbl"> Описание: </label>
<div class="input-txt_wrapper">
<textarea placeholder="Введите описание" class="input-txt" rows="5" cols="17" name="opis" maxlength="1000"><?= text($foto['opis'])?></textarea>
</div> </div> </div>
<div class="pad_t_a">
<div>
<label class="lbl">Расположение:</label>
<div class="input-txt_wrapper"> <select class="input-txt" name="id_kat">
<option value="0"<?echo ($foto['id_gallery'] == 0?" selected='selected'":null);?>>Корень</option>
<?
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '".$ank['id']."' AND `my` = '0'"), 0) > 0)
{
$q = mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '".$ank['id']."' AND `my` = '0' ORDER BY `name` ASC");
while ($post = mysql_fetch_assoc($q))
{
?>
<option value="<?echo $post['id'];?>"<?echo ($foto['id_gallery'] == $post['id']?" selected='selected'":null);?>>
<?echo stripcslashes(htmlspecialchars($post['name']));?>
</option>
<?
}
}
?>
</select></div>
</div>
</div>
</div>
<div>
<div class="block transpar">
<label class="input-checkbox">
<input value="1" <?= ($foto['metka'] == 1 ? "checked='checked'" : null)?> name="metka" class="m" type="checkbox">
<span class="m grey chb_lbl"><!-- --><span>Файл для взрослых <!-- --><span class=" red">(18+)</span><!-- --></span><!-- --></span>
</label>
</div> </div>
<table class="table__wrap table__links bord-top"> <tbody><tr>
<td class="table__cell" width="50%"> <!-- --><!-- --><!-- --><!-- -->
<button value="Сохранить" class=" link blue full is_final " id="cfms"><img src="/foto/style/ico/ok_blue.png" alt="" class="m"> <span class="m">Сохранить</span><!-- --></button><!-- --><!-- --> </td>
<td class="table__cell table__cell_last" width="50%"> <a href="?" class="link -full "> <span>Отменить</span> </a>
</td>
</tr> </tbody></table>
</div>
</form>
<div class="wrapper t_center"> <a href="?act=delete" class="link -full red "> <span><!-- --><img src="/foto/style/ico/delete.png" alt="" class="m"> <!-- --><span class="m">Удалить файл</span><!-- --></span> </a> </div>
<?
include_once '../sys/inc/tfoot.php';
exit;
}
if (isset($_GET['act']) && $_GET['act'] == 'delete')
{
?>
<div class="lc_br wbg font0 relative oh" id="header_path">
<a href="/" style="font-size:0;"> <img src="/foto/style/ico/home.png" alt=""> </a>
<span class="lc_brw">
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <a href="/info.php?id=<?= $ank['id']?>"><?= $ank['nick']?></a>
</span>
<span class="lc_brw">
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <a href="/foto/<?= $ank['id']?>/">Фото</a>
</span>
<span class="lc_brw">
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">Удаляем фото <?= text($foto['name'])?></span>
</span>
</div>
<div class="wrapper">
<div class="block bord-botm t_center grey">
<div class="t_center "> Вы уверены, что хотите удалить файл <!-- -->
<a href="?" class="arrow_link break-word"><!-- -->
<!-- --><span><b><?= text($foto['name'])?>.<?= $foto['ras']?></b></span></a>? </div>
</div>
<table class="table__wrap table__links"> <tbody><tr>
<td class="table__cell" width="50%">
<a href="?act=delete&ok" class="link -full blue "> <span><!-- --><img src="/foto/style/ico/ok_blue.png" alt="" class="m"> <!-- --><span class="m">Да</span><!-- --></span> </a>
</td>
<td class="table__cell table__cell_last" width="50%">
<a href="?" class="link -full "> <span>Отмена</span> </a>
</td>
</tr> </tbody></table>
</div>
<a href="?" class="link darkblue return full_link">
<img src="/foto/style/ico/arr_back.png" alt="" class="ico_arrow-back"> Назад
</a>
<?
include_once H.'sys/inc/tfoot.php';
exit;
}