function delete_videos() { $ds = DIRECTORY_SEPARATOR; //Get Details about the entity $entityController = new EntityController(); $entities = $entityController->get_video_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 //Video thumbnail has jpg extension $targetFile = dirname(__FILE__) . $ds . 'src' . $ds . $entity['album_ID'] . $ds . "thumb" . $ds . $entity['id'] . ".jpg"; if (!unlink($targetFile)) { echo "Error deleting {$targetFile}"; } else { echo "Deleted {$targetFile}"; } //Remove sql entity $entityController->remove_entity($entity['id']); } }
<i class="fa fa-download"></i> 下載 </a> </div> <div id="delete"> <a id="delete_button" onclick="show_delete_panel()"> <i class="fa fa-trash"></i> 刪除 </a> </div> </div> </div> <?php $videos = $entityController->get_video_from_album($album_ID); if (count($videos) != 0) { ?> <div class="container"> <div class="title">影片</div> <?php while ($thumbnail = $videos->fetchArray()) { ?> <div class="preview" onclick="view(<?php echo $thumbnail['id']; ?> )" style="background-image: url('src/<?php echo $album_ID;