메인에만 다른 썸네일 적용

메인에만 다른 썸네일 적용

QA

메인에만 다른 썸네일 적용

본문

상품등록시 상품 이미지 첨부하는 부분이 기본10군데가 있는듯 합니다.

리스트나 장바구니, 상세페이지 등에는 첫번째 첨부 이미지가 썸네일로 보이고,

메인에만 세번째나 네번째 첨부한 이미지가 썸네일로 보이게 하려면..

어떻게 해야 하는지 아시는분 답변 부탁드립니다..

 

현재 메인 부분 제품이미지 불러오는 소스는 아래 처럼 되어 있습니다. (main.10.skin.php)

 

<?php
for ($i=1; $row=sql_fetch_array($result); $i++) {
    if ($this->list_mod >= 2) { // 1줄 이미지 : 2개 이상
        if ($i%$this->list_mod == 0) $sct_last = 'sct_last'; // 줄 마지막
        else if ($i%$this->list_mod == 1) $sct_last = 'sct_clear'; // 줄 첫번째
        else $sct_last = '';
    } else { // 1줄 이미지 : 1개
        $sct_last = 'sct_clear';
    }

    if ($i == 1) {
        if ($this->css) {
            echo "<ul class=\"{$this->css}\">\n";
        } else {
            echo "<ul class=\"sct sct_10\">\n";
        }
    }

    echo "<li class=\"sct_li {$sct_last}\" style=\"width:{$this->img_width}px\">\n";

    echo "<div class=\"sct_img\">\n";
   
    if ($this->view_it_img) {
  echo "<a href=\"{$this->href}{$row['it_id']}\">\n";
        echo get_it_image($row['it_id'], $this->img_width, $this->img_height, '', '', stripslashes($row['it_name']))."\n";
        echo "</a>\n";
 }

    echo "</li>\n";
}

if ($i > 1) echo "</ul>\n";

if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\n";
?>

 

아무리 찾아 봐도..비슷한 문의가 없는 듯합니다;

두번째 줄 $i=1 부분 숫자를 바꾸거나..이것저것 해봐도 안되네요; 

 

이 질문에 댓글 쓰기 :

답변 3

echo get_it_image($row['it_id'], $this->img_width, $this->img_height, '', '', stripslashes($row['it_name']),'',3);

 

위와 같이 함수에 값이 하나더 넘겨서,

/lib/shop.lib.php 파일에서 get_it_image 부분을 아래와 같이 수정하면 됩니다.

 

function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img_alt='', $is_crop=false, $img_num=0)

......

for($i=1;$i<=10; $i++) {

$file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];

if(is_file($file) && $row['it_img'.$i] && $i>=$img_num) {

$size = @getimagesize($file);

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

continue;

 

$filename = basename($file);

$filepath = dirname($file);

$img_width = $size[0];

$img_height = $size[1];

 

break;

}

}

get_it_image 이미지가 이미지를 가져오는데 함수를 살펴보시고 

 

get_it_image2 이런식으로 추가해서 첫번째 말고 다른 이미지를 가지고 오게 만들어보세요


shop.lib.php
function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img_alt='', $is_crop=false,$it_img='')
 
for($i=1;$i<=10; $i++) {
        if($it_img&&$i==1)$i=$it_img;
        $file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];
 
main.10.skin.php
 
 echo get_it_image($row['it_id'], $this->img_width, $this->img_height, '', '', stripslashes($row['it_name']),3)."\n";
 
 
답변을 작성하시기 전에 로그인 해주세요.
전체 27
QA 내용 검색

회원로그인

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