<?php $id = filter_input(INPUT_POST, 'singleimage', FILTER_VALIDATE_INT); //$id = 45; $objImage = new classImage(); $image = $objImage->getImage($id); //var_dump($image); if (!is_null($image)) { ?> <figure class=""> <div class="blocimg"><img src="<?php echo $objImage->getRealPath(); ?> " alt="<?php echo $objImage->getNom(); ?> "> </div> <figcaption><?php echo $objImage->getCaption(); ?> </figcaption> </figure> <?php } else { echo 'Rien à afficher'; }
/** * Image handler desctructor * * @access public * @return void */ public function __destruct() { //--------------------------------------------------------- // Remove temp file if it hasn't been saved //--------------------------------------------------------- if (file_exists($this->temp_file)) { @unlink($this->temp_file); } parent::__destruct(); }
<?php $objImages = new classImage(); $images = $objImages->getAllImages(); ?> <div class="slideshow"> <ul> <?php foreach ($images as $key => $image) { ?> <li> <img src="<?php echo $objImages->encodeImage($image['real_path']); ?> " alt="<?php echo $image['nomImage']; ?> "> </li> <!-- <figcaption><?php echo $image['captionImage'] . ' '; ?> <?php if (isset($_SESSION['ID'])) { if ($image['idUser'] == $_SESSION['ID']) { ?> <a href="delete.php?idImage=<?php