본문에서 썸네일의 이미지가 없을시 노이미지 출력을 어떻게 해야할까요?

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
본문에서 썸네일의 이미지가 없을시 노이미지 출력을 어떻게 해야할까요?

QA

본문에서 썸네일의 이미지가 없을시 노이미지 출력을 어떻게 해야할까요?

본문

function get_thumbnail2($bo_table, $img, $width, $height=0, $alt, $view=0)
{
    $str = '';

    $file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$img;
    if(is_file($file))
        $size = @getimagesize($file);

    if($size[2] < 1 || $size[2] > 3)
        return '';

    $img_width = $size[0];
    $img_height = $size[1];
    $filename = basename($file);
    $filepath = dirname($file);

    if($img_width && !$height) {
        $height = round(($width * $img_height) / $img_width);
    }

    $thumb = thumbnail($filename, $filepath, $filepath, $width, $height, false, false, 'center', true, $um_value='80/0.5/3');

    if($thumb) {
        $file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);
        $str = '<a href="'.$file_url.'" target="_blank" class="popup_item_image"><img src="'.$file_url.'" alt="'.$alt.'"></a>';
    }

    if($view == 1) return $str;
}


<div id="sit_pvi_big">
						<?php for($i = 0; $i <= count($view['file']); $i++) { // 이미지 뷰 ?>
            <?php if($view['file'][$i]['file']){
                get_thumbnail2($bo_table, $view['file'][$i]['file'], 400, 300, $view['file'][$i]['bf_content']);
            ?>

							<?php echo get_thumbnail2($bo_table, $view['file'][$i]['file'], 400, 300, $view['file'][$i]['bf_content'], 1); ?>
			           <?php } ?>
            <?php } ?>
					</div>
					<div id="sit_pvi_thumb">
						<?php for($i = 0; $i <= count($view['file']); $i++) { // 이미지 뷰 ?>
            <?php if($view['file'][$i]['file']){
                get_thumbnail($bo_table, $view['file'][$i]['file'], 400, 300, $view['file'][$i]['bf_content']);
            ?>

							<?php echo get_thumbnail($bo_table, $view['file'][$i]['file'], 60, 60, $view['file'][$i]['bf_content'], 1); ?>
			           <?php } ?>
            <?php } ?>
					</div>

이 질문에 댓글 쓰기 :

답변 1

    if($thumb) {

        $file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);

        $str = '<a href="'.$file_url.'" target="_blank" class="popup_item_image"><img src="'.$file_url.'" alt="'.$alt.'"></a>';

    }


를 이렇게 하면 될듯 싶네요


    if($thumb) {

        $file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);

        $str = '<a href="'.$file_url.'" target="_blank" class="popup_item_image"><img src="'.$file_url.'" alt="'.$alt.'"></a>';

    } else {

        $str = '<a href="'.$file_url.'" target="_blank" class="popup_item_image"><img src="'.$board_skin_url.'/img/noimg.gif" alt="'.$alt.'"></a>'; 

    }  


스킨 폴더에  noimg.gif  이미지를 올려주시구요

답변을 작성하시기 전에 로그인 해주세요.
전체 0
QA 내용 검색
  • 개별 목록 구성 제목 답변작성자조회작성일
  • 질문이 없습니다.

회원로그인

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