function delete_images() { $ds = DIRECTORY_SEPARATOR; //Get Details about the entity $entityController = new EntityController(); $entities = $entityController->get_entity_from_album($_POST['album_ID']); //Delete Full size file while ($entity = $entities->fetchArray()) { $targetFile = dirname(__FILE__) . $ds . 'src' . $ds . $entity['album_ID'] . $ds . "img" . $ds . $entity['id'] . "." . $entity['extension']; if (!unlink($targetFile)) { echo "Error deleting {$targetFile}"; } else { echo "Deleted {$targetFile}"; } //Delete thumbnail file $targetFile = dirname(__FILE__) . $ds . 'src' . $ds . $entity['album_ID'] . $ds . "thumb" . $ds . $entity['id'] . "." . $entity['extension']; if (!unlink($targetFile)) { echo "Error deleting {$targetFile}"; } else { echo "Deleted {$targetFile}"; } //Remove sql entity $entityController->remove_entity($entity['id']); } }
</div> <?php } ?> <div class="title"> 相片 </div> </div> <?php } ?> <div class="container"> <?php $pictures = $entityController->get_entity_from_album($album_ID); while ($thumbnail = $pictures->fetchArray()) { ?> <div class="preview" onclick="view(<?php echo $thumbnail['id']; ?> )" style="background-image: url('src/<?php echo $album_ID; ?> /thumb/<?php echo $thumbnail['id'] . "." . $thumbnail['extension']; ?> ')"
<?php session_start(); include 'util/DBController.php'; include 'util/EntityController.php'; $dBController = new DBController(); $entityController = new EntityController(); //Store all entity ID $images = array(); $pictures = $entityController->get_entity_from_album($_SESSION['album_ID']); while ($thumbnail = $pictures->fetchArray()) { array_push($images, $thumbnail['id']); } function nextPhoto($index) { $currentKey = array_search($index, $GLOBALS['images']); $nextKey = $currentKey + 1; if (array_key_exists($nextKey, $GLOBALS['images'])) { return $GLOBALS['images'][$nextKey]; } else { return $GLOBALS['images'][0]; } } function previousPhoto($index) { $currentKey = array_search($index, $GLOBALS['images']); $nextKey = $currentKey - 1; if (array_key_exists($nextKey, $GLOBALS['images'])) { return $GLOBALS['images'][$nextKey]; } else { return end($GLOBALS['images']);