메인 배너 영상재생 기능추가.
This commit is contained in:
@ -49,21 +49,85 @@ while ($row = sql_fetch_array($result)) {
|
||||
$bn_border = isset($row['bn_border']) && $row['bn_border'] ? ' bn_border' : '';
|
||||
$bn_radius = isset($row['bn_radius']) && $row['bn_radius'] ? ' bn_radius' : '';
|
||||
$bn_image = G5_DATA_URL.'/banners/'.$row['bn_id'];
|
||||
$bn_content_type = isset($row['bn_content_type']) ? $row['bn_content_type'] : 'image';
|
||||
$bn_video_url = isset($row['bn_video_url']) ? $row['bn_video_url'] : '';
|
||||
$bn_youtube_url = isset($row['bn_youtube_url']) ? $row['bn_youtube_url'] : '';
|
||||
$bn_vimeo_url = isset($row['bn_vimeo_url']) ? $row['bn_vimeo_url'] : '';
|
||||
|
||||
// 새창 옵션
|
||||
$bn_new_win = isset($row['bn_new_win']) && $row['bn_new_win'] ? ' target="_blank"' : '';
|
||||
|
||||
if ($i == 0) echo '<div class="mod_bn_wrap rb_wide_bn_wrap rb_wide_bn_'.$row_mod['md_id'].'" style="background-color:'.$md_banner_bg.'"><div class="swiper-container swiper-container-slide_wide_bn_'.$row_mod['md_id'].'"><ul class="swiper-wrapper swiper-wrapper-slide_wide_bn swiper-wrapper-slide_wide_bn_'.$row_mod['md_id'].'">'.PHP_EOL;
|
||||
|
||||
// 콘텐츠 파일 존재 여부 확인
|
||||
$bimg = G5_DATA_PATH.'/banners/'.$row['bn_id'];
|
||||
if (file_exists($bimg)) {
|
||||
$banner = '';
|
||||
$size = getimagesize($bimg);
|
||||
$img_width = $size[0];
|
||||
$file_exists = file_exists($bimg);
|
||||
|
||||
// 콘텐츠 유형별 출력 가능 여부 확인
|
||||
$can_display = false;
|
||||
if ($bn_content_type === 'image' && $file_exists) {
|
||||
$can_display = true;
|
||||
} elseif ($bn_content_type === 'video' && $file_exists) {
|
||||
$can_display = true;
|
||||
} elseif ($bn_content_type === 'video_url' && !empty($bn_video_url)) {
|
||||
$can_display = true;
|
||||
} elseif ($bn_content_type === 'youtube' && !empty($bn_youtube_url)) {
|
||||
$can_display = true;
|
||||
} elseif ($bn_content_type === 'vimeo' && !empty($bn_vimeo_url)) {
|
||||
$can_display = true;
|
||||
}
|
||||
|
||||
// 출력 가능한 배너만 처리
|
||||
if ($can_display) {
|
||||
if ($i == 0) echo '<div class="mod_bn_wrap rb_wide_bn_wrap rb_wide_bn_'.$row_mod['md_id'].'" style="background-color:'.$md_banner_bg.'"><div class="swiper-container swiper-container-slide_wide_bn_'.$row_mod['md_id'].'"><ul class="swiper-wrapper swiper-wrapper-slide_wide_bn swiper-wrapper-slide_wide_bn_'.$row_mod['md_id'].'">'.PHP_EOL;
|
||||
|
||||
echo '<div class="swiper-slide swiper-slide-slide_wide_bn_'.$row_mod['md_id'].' slide_item top_ad">'.PHP_EOL;
|
||||
|
||||
echo '<div class="sl_bn_inner">'.PHP_EOL;
|
||||
echo '<img src="'.$bn_image.'" class="image_roll">'.PHP_EOL;
|
||||
|
||||
// 콘텐츠 유형별 렌더링
|
||||
if ($bn_content_type === 'image') {
|
||||
echo '<img src="'.$bn_image.'" class="image_roll">'.PHP_EOL;
|
||||
} elseif ($bn_content_type === 'video') {
|
||||
// 로컬 업로드 동영상
|
||||
echo '<video class="image_roll" autoplay muted playsinline loop controls style="width: 100%; height: 100%; object-fit: cover;">'.PHP_EOL;
|
||||
echo ' <source src="'.$bn_image.'" type="video/mp4">'.PHP_EOL;
|
||||
echo ' Your browser does not support the video tag.'.PHP_EOL;
|
||||
echo '</video>'.PHP_EOL;
|
||||
} elseif ($bn_content_type === 'video_url') {
|
||||
// 외부 비디오 URL (MP4, M3U8 등)
|
||||
echo '<video class="image_roll" autoplay muted playsinline loop controls style="width: 100%; height: 100%; object-fit: cover;">'.PHP_EOL;
|
||||
echo ' <source src="'.$bn_video_url.'" type="application/x-mpegURL">'.PHP_EOL;
|
||||
echo ' <source src="'.$bn_video_url.'" type="video/mp4">'.PHP_EOL;
|
||||
echo ' Your browser does not support the video tag.'.PHP_EOL;
|
||||
echo '</video>'.PHP_EOL;
|
||||
} elseif ($bn_content_type === 'youtube') {
|
||||
// 유튜브 embed URL 변환
|
||||
$youtube_embed_url = '';
|
||||
if (preg_match('/youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/', $bn_youtube_url, $match)) {
|
||||
$youtube_embed_url = 'https://www.youtube.com/embed/' . $match[1];
|
||||
} elseif (preg_match('/youtu\.be\/([a-zA-Z0-9_-]+)/', $bn_youtube_url, $match)) {
|
||||
$youtube_embed_url = 'https://www.youtube.com/embed/' . $match[1];
|
||||
} else {
|
||||
$youtube_embed_url = $bn_youtube_url;
|
||||
}
|
||||
echo '<iframe class="image_roll" style="width: 100%; height: 100%; border: none;" src="'.$youtube_embed_url.'" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'.PHP_EOL;
|
||||
} elseif ($bn_content_type === 'vimeo') {
|
||||
// 비메오 embed URL 변환
|
||||
$vimeo_embed_url = '';
|
||||
if (preg_match('/vimeo\.com\/(\d+)/', $bn_vimeo_url, $match)) {
|
||||
$vimeo_embed_url = 'https://player.vimeo.com/video/' . $match[1];
|
||||
} else {
|
||||
$vimeo_embed_url = $bn_vimeo_url;
|
||||
}
|
||||
echo '<iframe class="image_roll" style="width: 100%; height: 100%; border: none;" src="'.$vimeo_embed_url.'" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>'.PHP_EOL;
|
||||
} elseif ($bn_content_type === 'link') {
|
||||
// 외부 영상 링크 (MP4, M3U8, 스트리밍 URL 등)
|
||||
echo '<video class="image_roll" autoplay muted playsinline loop controls style="width: 100%; height: 100%; object-fit: cover;">'.PHP_EOL;
|
||||
echo ' <source src="'.$bn_video_url.'" type="application/x-mpegURL">'.PHP_EOL;
|
||||
echo ' <source src="'.$bn_video_url.'" type="video/mp4">'.PHP_EOL;
|
||||
echo ' Your browser does not support the video tag.'.PHP_EOL;
|
||||
echo '</video>'.PHP_EOL;
|
||||
}
|
||||
|
||||
echo '<div class="sl_overlay"></div>'.PHP_EOL;
|
||||
echo '<div class="sl_content" style="width:'.$rb_core['main_width'].'px">'.PHP_EOL;
|
||||
|
||||
@ -93,6 +157,8 @@ while ($row = sql_fetch_array($result)) {
|
||||
echo '<div class="sl_alt2 font-R"><span>'.$row['bn_alt2'].'</span></div>'.PHP_EOL;
|
||||
}
|
||||
|
||||
// 배너 링크 처리
|
||||
$banner = '';
|
||||
if(isset($row['bn_url']) && $row['bn_url']) {
|
||||
if ($row['bn_url'][0] == '#') {
|
||||
$banner .= '<a href="'.$row['bn_url'].'" class="sl_a_links font-B">';
|
||||
@ -111,10 +177,10 @@ while ($row = sql_fetch_array($result)) {
|
||||
}
|
||||
}
|
||||
|
||||
$banner .= '<div class="cb"></div>'.PHP_EOL;
|
||||
|
||||
|
||||
echo $banner;
|
||||
if($banner) {
|
||||
echo $banner;
|
||||
echo '<div class="cb"></div>'.PHP_EOL;
|
||||
}
|
||||
|
||||
echo '<div class="ico_j"><ul class="ico_j_ul1">'.PHP_EOL;
|
||||
|
||||
@ -128,18 +194,9 @@ while ($row = sql_fetch_array($result)) {
|
||||
echo '</ul><ul class="ico_j_ul2"><img src="'.G5_THEME_URL.'/rb.img/ico_j.svg"></ul></div>'.PHP_EOL;
|
||||
|
||||
|
||||
echo '</div><div class="cb"></div>'.PHP_EOL;
|
||||
|
||||
|
||||
echo '</div>'.PHP_EOL;
|
||||
|
||||
|
||||
|
||||
|
||||
if (isset($row['bn_ad_ico']) && $row['bn_ad_ico']) {
|
||||
echo '<span class="ico_ad">AD</span>'.PHP_EOL;
|
||||
}
|
||||
echo '</div>'.PHP_EOL;
|
||||
echo '</div>'.PHP_EOL; // sl_content 닫기
|
||||
echo '</div>'.PHP_EOL; // sl_bn_inner 닫기
|
||||
echo '</div>'.PHP_EOL; // swiper-slide 닫기
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user