$user = User::getUser(USER); // получени списка всех альбомов $albums = Albums::getAlbums(USER, 0); // получени фотографий альбома, чей id в get параметре в url if (isset($_GET['id'])) { $photos = Photos::get(USER, $_GET['id'], 1, 0); } // установка фотографии на обложку альбома if (isset($_POST['mainSave'])) { $mainPhoto = Photos::getById(USER, $_POST['mainPhoto'], 0); Photos::makeCover($mainPhoto->owner_id, $mainPhoto->id, $mainPhoto->album_id); header('Location: ' . $_SERVER['HTTP_REFERER']); } // сохранение описания к фотографии if (isset($_POST['descSave'])) { $mainPhoto = Photos::getById(USER, $_POST['descId'], 0); Photos::edit($mainPhoto->owner_id, $mainPhoto->id, $_POST['descPhoto']); header('Location: ' . $_SERVER['HTTP_REFERER']); } // перемещение фотографии влево (вверх) if (isset($_POST['topOrder'])) { $before = $_POST['before']; $after = isset($_POST['after']) ? $_POST['after'] : null; Photos::reOrder($_POST['owner'], $_POST['photo'], $before, $after); header('Location: ' . $_SERVER['HTTP_REFERER']); } // перемещение фотографии вправо (вниз) if (isset($_POST['botOrder'])) { $after = $_POST['after']; Photos::reOrder($_POST['owner'], $_POST['photo'], null, $after); header('Location: ' . $_SERVER['HTTP_REFERER']);
echo "<img style = 'width: 100%; margin-bottom: 6px;' src = '".$photo->photo_807."'>"; } else { echo "<img style = 'width: 100%; margin-bottom: 6px;' src = '".$photo->photo_604."'>"; } echo "<h1 id = 'content_header_name'> Likes: ".$photo->likes['count']." Comments: ".$photo->comments['count']."</h1>"; echo "<div id = 'hr'></div>"; echo "<h1 id = 'content_header_name'> Capition: ".$photo->text."</h1>"; break; case (cover): $result = Photos::makeCover(UID, $_GET['id'], $_GET['aid']); echo "<h1 id = 'content_header_name'>".$result."</h1>"; break; case (edit): $photo = Photos::getById(UID, $_GET['id'], 1); if (empty($_POST)) { ?> <form enctype="multipart/form-data" action="photo.php?action=edit&aid=<?php echo $_GET['aid']; ?> &id=<?php echo $_GET['id']; ?> " method="post"> <div id = "content_2_row"> <div id = "content_2_row_name"> Описание: </div> <textarea id = "width_200" name="description"><?php echo $photo->text; ?>
/** * Show the form for creating a new resource. * * @return Response */ public function create(Photos $photosModel) { $num = $photosModel->getById(); return view('photo.index', ['post' => $num]); }