<?php $page = "Gallery"; $action="edit"; ?>
<?php include "../../routes/gallery.php"; ?>
<?php include "../layout/header.php"; ?>
<body>

    <?php include "../layout/navbar.php"; ?>

    <div class="container-fluid">
      <div class="row">
        <?php include "../layout/sidenav.php"; ?>
        
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
            <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                <h1 class="h2">Edit <?php echo $page; ?></h1>
            </div>
            <form action="" method="POST" autocomplete="off" enctype="multipart/form-data">
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="caption">Caption</span>
                    </div>
                    <input type="text" name="caption" class="form-control" placeholder="Write the caption here" 
                    aria-label="caption" aria-describedby="caption" required
                    value="<?php echo $gallery_image->caption; ?>">
                </div>
                <div class="input-group mb-3">
                    <div class="custom-file">
                        <input type="hidden" name="oldImage" value="<?php echo $gallery_image->image; ?>">                                
                        <input type="file" name="fileToUpload" class="custom-file-input" id="image" aria-describedby="thumbnail">
                        <label class="custom-file-label" for="image">Choose thumbnail</label>
                    </div>    
                </div>
                <div class="input-group mb-3 justify-content-center">
                    <div class="col-6" id="displayThumbnail"> 
                        <img src="../assets/images/<?php echo $image->filename;?>" class="img-fluid">
                    </div>
                </div>
                <div class="input-group mb-3">
                    <input type="submit" class="btn btn-sm btn-primary gsa-text-white" name="edit" value="Edit">
                </div>
            </form>
        </main>

      </div>
    </div>
</body>
</html>