채택완료

썸네일 관련 질문입니다.

2018-01-29 (월) 12:19:43 1,907

다운 받은 스킨을 좀 수정하고 있어서

요즘 이곳에 질문을 많이 올리네요

프로그램을 잘 몰라서 올리니 이해해 주시고 답변 좀 부탁 드리겠습니다.

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

첨부파일에 이미지 올리면 썸네일이 잘 추출 되는데

1. 링크1에 유튜브 주소를 삽입하면 썸네일이 나오고

2. 에디터로 이미지를 올리면 썸네일이 나오게 하고 싶습니다.

3. 첨부파일과 유튜브가 동시에 있는 경우에는 첨부파일이 나오기를 원합니다.

Copy
<?php
                    if ($list[$i]['is_notice']) { // 공지사항  ?>
                        <strong style="width:<?php echo $board['bo_gallery_width'] ?>px;height:<?php echo $board['bo_gallery_height'] ?>px">공지</strong>
                    <?php } else {
                        $thumb = get_list_thumbnail2($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], '0');

                        if($thumb['src']) {
                $board['bo_gallery_height'] = $thumb['thumb_height'];
                            $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
                        } else {
                            $thumb = get_list_thumbnail2($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], '0');
                        }

                        echo $img_content;
                    }
                     ?>

모바일에서 비슷한 질문을 올려서 답변을 받아 해결했는데 이것을 조금만 수정하면 되는데 어렵네요.

pc용 스킨에 적용 할려고 합니다.

아래는 답변 받은 소스입니다.

Copy
//첨부파일 확인

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

채택된 답변
+20 포인트

첨부파일에 이미지 올리면 썸네일이 잘 추출 되는데 

>> 네 잘 추출되죠

1. 링크1에 유튜브 주소를 삽입하면 썸네일이 나오고

>> 링크1에 유튜브 주소와 썸네일은 관계가 없습니다.

2. 에디터로 이미지를 올리면 썸네일이 나오게 하고 싶습니다.

>> 에디터로 이미지 올려도 목록에 썸네일 추출됩니다.

3. 첨부파일과 유튜브가 동시에 있는 경우에는 첨부파일이 나오기를 원합니다.

>> 유튜브 존재여부와 관계없이 첨부파일이 gif 나 jpg png 이면 썸네일 생성됩니다.

목록에 이미지가 유튜브 링크가 존재할때만 보이고 싶다는 건가요?

그렇다면 list.skin.php 에서 if ($list[$i][wr_link1]) { echo "<img src=..."; }  로 감싸주면 되겠죠.

이상 저의 방법론적 답변이었습니다.   https://sir.kr/request 

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