갤러리 게시판 리스트에서 첨부파일2번도 나오게 하는 방법

갤러리 게시판 리스트에서 첨부파일2번도 나오게 하는 방법

QA

갤러리 게시판 리스트에서 첨부파일2번도 나오게 하는 방법

답변 1

본문

현재 갤러리 리스트에서 첨부파일 1번만 나옵니다.

근데 첨부파일2번도 나오게 하고싶습니다.

 

<div class="gall_img">
    <a href="<?php echo $list[$i]['href'] ?>">
        <?php
            if ($list[$i]['is_notice']) { // 공지사항  ?>
                <span class="is_notice">공지</span>
                <?php } else {
                    $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'],                                                 $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);

                    if($thumb['src']) {
                    $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
                 } else {
                    $img_content = '<span class="no_image">no image</span>';
                }

                    echo $img_content;
                }
        ?>
    </a>
</div>

 

현재 코드는 이렇게 되어있습니다.

어떻게 수정하면 될까요?

이 질문에 댓글 쓰기 :

답변 1

https://sir.kr/g5_tip/2410

이거 참조하시구요..

에디터 내의 이미지 추출이라면,

/lib/thumbnail.lib.php 파일에서 아래 부분도 수정해야 합니다.

$tmp 를 추가했습니다.


$tmp = 0;
for($i=0; $i<count($matches[1]); $i++)
{
// 이미지 path 구함
$p = parse_url($matches[1][$i]);
if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
$data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
else
$data_path = $p['path'];
 
$srcfile = G5_PATH.$data_path;
 
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
if($tmp == $option) {
$size = @getimagesize($srcfile);
if(empty($size))
continue;
 
$filename = basename($srcfile);
$filepath = dirname($srcfile);
 
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
$alt = get_text($malt[1]);
 
break;
}
$tmp++;
}
}
답변을 작성하시기 전에 로그인 해주세요.
전체 1
© SIRSOFT
현재 페이지 제일 처음으로