116 lines
4.8 KiB
PHP
116 lines
4.8 KiB
PHP
<?php
|
|
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
|
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
|
|
|
|
// 이 페이지에서도 스킨의 CSS 파일을 불러옵니다.
|
|
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . time() . '">', 0);
|
|
?>
|
|
|
|
<section id="bo_v">
|
|
<h2 id="bo_v_title">
|
|
<?php if ($category_name) { ?><span class="item-category"><?php echo $view['ca_name']; ?></span><?php } ?>
|
|
<?php echo cut_str(get_text($view['wr_subject']), 70); // 글제목 출력 ?>
|
|
</h2>
|
|
|
|
<div id="bo_v_info">
|
|
<span><i class="fa fa-user" aria-hidden="true"></i> <strong><?php echo $view['name'] ?></strong></span>
|
|
<span><i class="fa fa-clock-o" aria-hidden="true"></i> <?php echo date("Y-m-d H:i", strtotime($view['wr_datetime'])) ?></span>
|
|
<span><i class="fa fa-eye" aria-hidden="true"></i> <?php echo number_format($view['wr_hit']) ?></span>
|
|
<span><?php echo '제품글 번호 : '.$wr_id; ?></span>
|
|
</div>
|
|
|
|
<div id="bo_v_atc">
|
|
<!-- 1. 본문 내용이 먼저 나오도록 순서 변경 -->
|
|
<div id="bo_v_con">
|
|
<!-- --><?php //echo $view['content']; ?>
|
|
<?php echo conv_content($view['content'],1); ?>
|
|
</div>
|
|
|
|
<?php
|
|
// 📌 [최종 수정] 올바른 서버 경로를 사용하여 썸네일을 생성합니다.
|
|
if (isset($view['file']) && is_array($view['file']) && count($view['file'])) {
|
|
echo "<div id=\"bo_v_img\">\n";
|
|
|
|
// 썸네일을 저장할 실제 서버 폴더 경로를 지정합니다.
|
|
$source_path = G5_DATA_PATH.'/file/'.$bo_table;
|
|
|
|
foreach ($view['file'] as $file) {
|
|
// 파일 정보가 유효한지 확인합니다.
|
|
if ( !is_array($file) || empty($file['file']) ) {
|
|
continue;
|
|
}
|
|
|
|
// 올바른 서버 경로를 사용하여 썸네일을 생성합니다.
|
|
$thumb = thumbnail($file['file'], $source_path, $source_path, 200, 200, false, true);
|
|
|
|
if($thumb) {
|
|
// 화면에 표시할 올바른 웹 주소(URL)를 생성합니다.
|
|
$img_src = G5_DATA_URL.'/file/'.$bo_table.'/'.$thumb;
|
|
$original_href = G5_DATA_URL.'/file/'.$bo_table.'/'.$file['file'];
|
|
|
|
// 최종 HTML 구조를 생성합니다.
|
|
echo '<a href="'.$original_href.'" class="view_image_link">';
|
|
$alt_text = isset($file['source']) ? get_text($file['source']) : '';
|
|
echo '<img src="'.$img_src.'" alt="'.$alt_text.'">';
|
|
echo '</a>';
|
|
}
|
|
}
|
|
echo "</div>\n";
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<div id="bo_v_bot">
|
|
<div class="btn_area">
|
|
<?php if ($update_href) { ?><a href="<?php echo $update_href ?>" class="btn_b02 btn">수정</a><?php } ?>
|
|
<?php if ($delete_href) { ?><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;" class="btn_b02 btn">삭제</a><?php } ?>
|
|
<?php if ($reply_href) { ?><a href="<?php echo $reply_href ?>" class="btn_b02 btn">답변</a><?php } ?>
|
|
<?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn_b02 btn">글쓰기</a><?php } ?>
|
|
<a href="<?php echo $list_href ?>" class="btn_b01 btn">목록</a>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- 이미지 팝업(라이트박스) HTML과 스크립트 -->
|
|
<div id="image_lightbox" class="image_lightbox">
|
|
<span class="lightbox_close">×</span>
|
|
<img class="lightbox_content" id="lightbox_image">
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const lightbox = document.getElementById('image_lightbox');
|
|
const lightboxImage = document.getElementById('lightbox_image');
|
|
const imageLinks = document.querySelectorAll('.view_image_link');
|
|
const closeBtn = document.querySelector('.lightbox_close');
|
|
|
|
if (!lightbox || !imageLinks.length) return;
|
|
|
|
imageLinks.forEach(link => {
|
|
link.addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
lightboxImage.src = this.href;
|
|
lightbox.style.display = 'flex';
|
|
});
|
|
});
|
|
|
|
function closeModal() {
|
|
lightbox.style.display = 'none';
|
|
lightboxImage.src = '';
|
|
}
|
|
|
|
if(closeBtn) {
|
|
closeBtn.addEventListener('click', closeModal);
|
|
}
|
|
lightbox.addEventListener('click', function(e) {
|
|
if (e.target === lightbox) {
|
|
closeModal();
|
|
}
|
|
});
|
|
document.addEventListener('keydown', function(e) {
|
|
if (e.key === 'Escape' && lightbox.style.display === 'flex') {
|
|
closeModal();
|
|
}
|
|
});
|
|
});
|
|
</script>
|