간단한 소스 좀 봐 주실래요? 채택완료
모바일 게시판에서
사진과 동영상을 함께 글을 올리면
리스트 목록에서 동영상 캡쳐 이미지가 먼저 나오게 되어 있습니다. 그런데
사진과 동영상을 함께 글을 올리면
리스트 목록에서 사진 이미지가 먼저 나오게 하고 싶습니다.
아래 소스를 위아래만 바꾸면 될거 같은데
잘 되지 않아서 질문 올립니다.
</strong></p>
<p> <?php
for ($i=0; $i<count($list); $i++) {
?>
<div class="gall_li <?php if ($wr_id == $list[$i]['wr_id']) { ?>gall_now<?php } ?>">
<?php if ($list[$i]['wr_10']) { ?>
<!-- 유튜브 동영상 시작 { -->
<?php
$youtube_link = $list[$i]['wr_10'];
$youtube_url = parse_url($youtube_link);
parse_str($youtube_url['query']);
?>
<?php if($v){ ?>
<div class="youtubeWrap">
<iframe width="728" height="450" src="//www.youtube.com/embed/<?php echo $v; ?>?feature=player_detailpage&vq=hd720" frameborder="0" allowfullscreen></iframe>
</div>
<?php } ?>
<!-- } 유튜브 동영상 끝 -->
<?php } else { ?>
<!-- 이미지 시작 { -->
<a href="<?php echo $list[$i]['href'] ?>" class="gall_img">
<?php
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_mobile_gallery_width'], $board['bo_mobile_gallery_height']);</p>
<p> if($thumb['src']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_mobile_gallery_width'].'" height="'.$board['bo_mobile_gallery_height'].'">';</p>
<p> // 외부 이미지 썸네일 만들기 {
} else if($url_img = get_editor_image($list[$i]['wr_content'])){
$img_src = $url_img[1][0];
preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img_src, $m);
$src = htmlspecialchars_decode($m[1]);
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $img_src, $m);
$alt = get_text($m[1]);
$filename = hash("sha256", $src);
$source_path = $target_path = G5_DATA_PATH.'/file/'.$board['bo_table'];
$file_download = $target_path."/".$filename;
if (!file_exists($file_download)) {
copy($src, $file_download);
}
$thumb_src = thumbnail($filename, $source_path, $target_path, $board['bo_mobile_gallery_width'], $board['bo_mobile_gallery_height'], false, true);
$img_content = '<img src="'.G5_DATA_URL.'/file/'.$board['bo_table'].'/'.$thumb_src.'" alt="'.$alt.'" >';
// } 외부 이미지 썸네일 만들기</p>
<p> } else {
$img_content = '';
}</p>
<p> echo $img_content;
}</p>
<p>
{
$v_img_count = count($list[$i]['file']);
if($v_img_count && !$img_content) {
if ($list[$i]['file'][0]['view']) {
echo strip_tags(get_view_thumbnail($list[$i]['file'][0]['view']), '<img>');
}
}
?>
</a>
<!-- } 이미지 끝 -->
<?php } ?>
</div></p>
<p><strong>
답변 2개
그리 해 봤는데.. 오류가 좀 있어서요 <---- 소스 이동을 잘못 한 것 아닌가요?
그게 어렵다면 아래처럼 해보세요
22행을 잘라서 5행 if문 위쪽에 넣고 5행 수정
if (!$thumb['src'] && $list[$i]['wr_10']) {
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
구문 오류가 좀 있는듯 싶네요