간단한 소스 좀 봐 주실래요?

간단한 소스 좀 봐 주실래요?

QA

간단한 소스 좀 봐 주실래요?

본문

모바일 게시판에서

사진과 동영상을 함께 글을 올리면

리스트 목록에서 동영상 캡쳐 이미지가 먼저 나오게 되어 있습니다.

그런데

사진과 동영상을 함께 글을 올리면

리스트 목록에서 사진 이미지가 먼저 나오게 하고 싶습니다.

 

아래 소스를 위아래만 바꾸면 될거 같은데

잘 되지 않아서 질문 올립니다.

 


            <?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']);
                           if($thumb['src']) {
                              $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_mobile_gallery_width'].'" height="'.$board['bo_mobile_gallery_height'].'">';
                                //    외부 이미지 썸네일 만들기 {
                                } 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.'" >';
                                //    } 외부 이미지 썸네일 만들기
                           } else {
                              $img_content = '';
                            }
                            echo $img_content;
                        }

                        {
                        $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>

이 질문에 댓글 쓰기 :

답변 2

그리 해 봤는데.. 오류가 좀 있어서요 <---- 소스 이동을 잘못 한 것 아닌가요?

그게 어렵다면 아래처럼 해보세요

 

22행을 잘라서 5행 if문 위쪽에 넣고 5행 수정

if (!$thumb['src'] && $list[$i]['wr_10']) {

 

<?php if ($list[$i]['wr_10']) {  ?>

여기 있는 if문 순서만 바꾸면 될것같은데요? 유투브 시작부분을 else문 안에 넣고 이미지 부분을 if문안에 넣으면되요

답변을 작성하시기 전에 로그인 해주세요.
전체 116
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT