채택완료

모바일에서 유튜브 주소 넣으면 썸네일 이미지 나오게 할려면..

2018-01-27 (토) 22:00:01 3,592

링크1에 유뷰트 주소를 넣으면

모바일에서 썸네일 이미지가 보이게 하고 싶습니다.

http://www.iesc.co.kr/board/bbs/board.php?bo_table=1

(위에 주소를 모바일에서 확인하셔야 합니다.)

첨부파일에 이미지가 있으면 그 썸네일 이미지를 보여주고

링크1에 유튜드 주소가 있으면 그 썸네일 이미지를 보여주고 싶은데.

만일

둘다 같이 있을때는 첨부파일 이미지를 우선으로 보여주고 싶습니다.

아래 소스를 어떻게 해야 할까요?

보통은 아래 코드를 입력하는 것으로 알고 있는데 안되서요

Copy
<?php } else {
      $youtube_key = substr($list[$i]['link'][1],-11,11);
                       
      $img_content = '<img src="https://img.youtube.com/vi/'.$youtube_key.'/mqdefault.jpg" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
                        echo $img_content;
      
                    }
                     ?>

아래 소스를 어떻게 수정해야 하는지 좀 알려주시면 감사하겠습니다.

Copy
$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'].'" class="thumb_img">';
  } else {
   $img_content = '';
  }
|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

//첨부파일 확인

$sql = " select bf_file, bf_content from {$g5['board_file_table']}
where bo_table = '$bo_table' 
and wr_id = '$wr_id' 
and bf_type 
between '1' and '3' 
order by bf_no 
limit 0, 1 ";
$row = sql_fetch($sql);

$img_content="";

//첨부파일이 있다면

if($row['bf_file']) {
    $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'].'" class="thumb_img">';
    }
}

첨부파일이 없고 링크가 있다면
if( $img_content=="" && $list[$i]['link'][1]){
    $youtube_key = substr($list[$i]['link'][1],-11,11);
    $img_content = '<img src="https://img.youtube.com/vi/'.$youtube_key.'/mqdefault.jpg" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
}

//첨부파일도 없고 링크도 없다면

if($img_content==""){
    //에디터 확인
    $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'].'" class="thumb_img">';
    }
}

답변에 대한 댓글 1개

감사합니다. 잘 해결 됐습니다.

답변을 작성하려면 로그인이 필요합니다.