first commit 2

This commit is contained in:
hmw1001
2026-06-11 18:47:38 +09:00
parent c768729ce6
commit 6f534e33a6
11095 changed files with 1595758 additions and 0 deletions
@@ -0,0 +1,18 @@
<?php
if (!defined('_GNUBOARD_')) exit;
/**
* rb.custom :: media_gallery_section/config.php
* 미디어 갤러리 모듈 설정 파일
*/
$media_gallery_config = [
'bo_table' => 'photonews',
'grid_columns' => 4,
'grid_rows' => 1,
'subject_len' => 40, // 💡 [핵심 추가] 제목 글자 수 제한
];
// 총 아이템 개수는 n * m 으로 계산
$media_gallery_config['load_rows'] = $media_gallery_config['grid_columns'] * $media_gallery_config['grid_rows'];
?>
@@ -0,0 +1,68 @@
/* Media Gallery Section Style */
.media-gallery-section {
width: 100%;
}
.gallery-grid {
display: grid;
grid-template-columns: repeat(var(--grid-columns, 4), 1fr);
gap: 2px;
list-style: none;
padding: 0;
margin: 0;
}
.gallery-item {
position: relative;
overflow: hidden;
padding-top: 100%; /* 기본값: 정사각형 비율 */
}
.gallery-item a {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
text-decoration: none;
}
.gallery-image,
.gallery-image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.gallery-caption {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 20px 15px;
background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
color: #fff;
}
.gallery-caption h3 {
margin: 0;
font-size: 1rem;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 💡 [핵심 추가] 1x1 그리드일 때만 적용되는 특별 스타일 */
.is-single-item .gallery-item {
padding-top: 0; /* 정사각형 비율 해제 */
height: 250px; /* 높이 250px로 고정 */
}
.empty-gallery {
grid-column: 1 / -1;
text-align: center;
padding: 50px;
}
@@ -0,0 +1,5 @@
// media_gallery_section 모듈을 위한 JavaScript
window.initMediaGalleryModule = function(moduleId) {
// 이 모듈은 현재 특별한 JavaScript 로직이 필요 없습니다.
// console.log(`Media Gallery Module (ID: ${moduleId}) initialized.`);
};
@@ -0,0 +1,54 @@
<?php
if (!defined('_GNUBOARD_')) exit;
// 1. 설정 파일 로드
$config_path = __DIR__ . '/config.php';
if (!file_exists($config_path)) return;
include_once($config_path);
// 2. 설정값에 따라 데이터 가져오기
$bo_table = $media_gallery_config['bo_table'];
$load_rows = $media_gallery_config['load_rows'];
$grid_columns = $media_gallery_config['grid_columns'];
$subject_len = $media_gallery_config['subject_len'];
$list = get_latest($bo_table, $load_rows, $subject_len);
// 3. CSS 변수 및 조건부 클래스 설정
$css_vars = "--grid-columns: {$grid_columns};";
$section_class = 'media-gallery-section';
// 💡 [핵심 추가] 1x1 그리드일 경우 특별 클래스를 추가합니다.
if ($grid_columns == 1 && $media_gallery_config['grid_rows'] == 1) {
$section_class .= ' is-single-item';
}
?>
<div class="<?php echo $section_class; ?>" style="<?php echo $css_vars; ?>">
<ul class="gallery-grid">
<?php
for ($i = 0; $i < count($list); $i++) {
$item = $list[$i];
$thumb = get_list_thumbnail($bo_table, $item['wr_id'], 400, 400, false, true);
$thumb_src = $thumb['src'] ?: G5_THEME_URL . '/rb.img/no_image.png';
?>
<li class="gallery-item">
<a href="<?php echo $item['href']; ?>">
<div class="gallery-image">
<img src="<?php echo $thumb_src; ?>" alt="<?php echo $item['subject']; ?>">
</div>
<div class="gallery-caption">
<h3><?php echo $item['subject']; ?></h3>
</div>
</a>
</li>
<?php
}
if (count($list) == 0) {
echo "<li class='empty-gallery'>게시물이 없습니다.</li>";
}
?>
</ul>
</div>
<link rel="stylesheet" href="<?php echo G5_THEME_URL; ?>/rb.custom/media_gallery_section/module.css?ver=<?php echo G5_CSS_VER; ?>">