메인 배너 영상재생 기능추가.
This commit is contained in:
@ -29,6 +29,26 @@ if (!sql_query("SELECT bn_device FROM rb_banner LIMIT 0, 1")) {
|
||||
sql_query("UPDATE rb_banner SET bn_device = 'pc'", true);
|
||||
}
|
||||
|
||||
// 콘텐츠 유형 필드 추가 (image/video/video_url/youtube/vimeo)
|
||||
if (!sql_query("SELECT bn_content_type FROM rb_banner LIMIT 0, 1")) {
|
||||
sql_query("ALTER TABLE `rb_banner` ADD `bn_content_type` varchar(20) NOT NULL DEFAULT 'image' AFTER `bn_device`", true);
|
||||
}
|
||||
|
||||
// 비디오 URL 필드 추가
|
||||
if (!sql_query("SELECT bn_video_url FROM rb_banner LIMIT 0, 1")) {
|
||||
sql_query("ALTER TABLE `rb_banner` ADD `bn_video_url` varchar(500) NOT NULL DEFAULT '' AFTER `bn_content_type`", true);
|
||||
}
|
||||
|
||||
// 유튜브 URL 필드 추가
|
||||
if (!sql_query("SELECT bn_youtube_url FROM rb_banner LIMIT 0, 1")) {
|
||||
sql_query("ALTER TABLE `rb_banner` ADD `bn_youtube_url` varchar(500) NOT NULL DEFAULT '' AFTER `bn_video_url`", true);
|
||||
}
|
||||
|
||||
// 비메오 URL 필드 추가
|
||||
if (!sql_query("SELECT bn_vimeo_url FROM rb_banner LIMIT 0, 1")) {
|
||||
sql_query("ALTER TABLE `rb_banner` ADD `bn_vimeo_url` varchar(500) NOT NULL DEFAULT '' AFTER `bn_youtube_url`", true);
|
||||
}
|
||||
|
||||
include_once(G5_ADMIN_PATH . '/admin.head.php');
|
||||
?>
|
||||
|
||||
@ -45,9 +65,23 @@ include_once(G5_ADMIN_PATH . '/admin.head.php');
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_content_type">콘텐츠 유형</label></th>
|
||||
<td>
|
||||
<?php echo help("배너의 콘텐츠 유형을 선택하세요."); ?>
|
||||
<?php $bn_content_type = isset($bn['bn_content_type']) ? $bn['bn_content_type'] : 'image'; ?>
|
||||
<select name="bn_content_type" id="bn_content_type" onchange="toggleContentInputs()">
|
||||
<option value="image" <?php echo get_selected($bn_content_type, 'image', true); ?>>이미지</option>
|
||||
<option value="video" <?php echo get_selected($bn_content_type, 'video', true); ?>>동영상 파일 (로컬 업로드)</option>
|
||||
<option value="video_url" <?php echo get_selected($bn_content_type, 'video_url', true); ?>>비디오 URL (MP4, M3U8 등)</option>
|
||||
<option value="youtube" <?php echo get_selected($bn_content_type, 'youtube', true); ?>>유튜브</option>
|
||||
<option value="vimeo" <?php echo get_selected($bn_content_type, 'vimeo', true); ?>>비메오</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="image_row">
|
||||
<th scope="row">이미지</th>
|
||||
<td>
|
||||
<input type="file" name="bn_bimg">
|
||||
<input type="file" name="bn_bimg" accept="image/*">
|
||||
<?php
|
||||
$bimg_str = "";
|
||||
$bimg = G5_DATA_PATH . "/banners/" . $bn['bn_id'];
|
||||
@ -66,6 +100,43 @@ include_once(G5_ADMIN_PATH . '/admin.head.php');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="video_row" style="display:none;">
|
||||
<th scope="row">동영상 파일</th>
|
||||
<td>
|
||||
<?php echo help("MP4, MKV, MOV, WebM 등의 동영상 파일을 업로드하세요."); ?>
|
||||
<input type="file" name="bn_video_file" accept="video/*">
|
||||
<?php
|
||||
if (isset($bn['bn_id']) && $bn['bn_id'] && $bn_content_type === 'video') {
|
||||
$video_file = G5_DATA_PATH . "/banners/" . $bn['bn_id'];
|
||||
if (file_exists($video_file)) {
|
||||
echo '<div><p>업로드된 파일: ' . basename($video_file) . '</p>';
|
||||
echo '<input type="checkbox" name="bn_video_del" value="1" id="bn_video_del"> <label for="bn_video_del">삭제</label></div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="video_url_row" style="display:none;">
|
||||
<th scope="row">비디오 URL</th>
|
||||
<td>
|
||||
<?php echo help("MP4, M3U8, DASH 등의 비디오 파일 직접 URL을 입력하세요."); ?>
|
||||
<input type="text" name="bn_video_url" value="<?php echo isset($bn['bn_video_url']) ? htmlspecialchars($bn['bn_video_url']) : ''; ?>" class="frm_input" size="80" placeholder="https://example.com/video.mp4">
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="youtube_row" style="display:none;">
|
||||
<th scope="row">유튜브</th>
|
||||
<td>
|
||||
<?php echo help("유튜브 URL을 입력하세요. (예: https://www.youtube.com/watch?v=xxxxx 또는 https://youtu.be/xxxxx)"); ?>
|
||||
<input type="text" name="bn_youtube_url" value="<?php echo isset($bn['bn_youtube_url']) ? htmlspecialchars($bn['bn_youtube_url']) : ''; ?>" class="frm_input" size="80" placeholder="https://www.youtube.com/watch?v=...">
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="vimeo_row" style="display:none;">
|
||||
<th scope="row">비메오</th>
|
||||
<td>
|
||||
<?php echo help("비메오 URL을 입력하세요. (예: https://vimeo.com/xxxxx)"); ?>
|
||||
<input type="text" name="bn_vimeo_url" value="<?php echo isset($bn['bn_vimeo_url']) ? htmlspecialchars($bn['bn_vimeo_url']) : ''; ?>" class="frm_input" size="80" placeholder="https://vimeo.com/...">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="bn_alt">메인타이틀</label></th>
|
||||
<td>
|
||||
@ -205,6 +276,20 @@ include_once(G5_ADMIN_PATH . '/admin.head.php');
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function toggleContentInputs() {
|
||||
const contentType = document.getElementById('bn_content_type').value;
|
||||
document.getElementById('image_row').style.display = (contentType === 'image') ? 'table-row' : 'none';
|
||||
document.getElementById('video_row').style.display = (contentType === 'video') ? 'table-row' : 'none';
|
||||
document.getElementById('video_url_row').style.display = (contentType === 'video_url') ? 'table-row' : 'none';
|
||||
document.getElementById('youtube_row').style.display = (contentType === 'youtube') ? 'table-row' : 'none';
|
||||
document.getElementById('vimeo_row').style.display = (contentType === 'vimeo') ? 'table-row' : 'none';
|
||||
}
|
||||
|
||||
// 페이지 로드 시 초기화
|
||||
document.addEventListener('DOMContentLoaded', toggleContentInputs);
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_ADMIN_PATH . '/admin.tail.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user