테스트 사이트 - 개발 중인 베타 버전입니다

영카트에서 상품이미지들 사이즈 조절 질문이요! 채택완료

경하귀요밍 8년 전 조회 6,075

영카트에서 분류나 상품 이미지 사이즈를 관리자 페이지에서 이미지폭이랑 이미지 높이 값을 적는데,

 

이값을 안적고 직접 코드로 사이즈를 주고싶으면 어떻게 해야하나요?

 

ex) 영카트의 관리자 페이지 - 쇼핑몰관리 - 분류관리 에서 이미지 폭, 이미지 높이 값에 제약되지 않고, 이미지 폭, 높이 값을 해당 분류 스킨에서 이미지 사이즈를 코드로 조절하고싶습니다.

 

skin/shop/basic/list.30.skin.php 파일에서 

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

"$this->img_width, $this->img_height" 이부분을 삭제하고싶은데 삭제하면 오류가 생기더라구요.. 혹시 다른방법이 없을까요??(css를 반응형으로 만들었습니다.)

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

답변 2개

채택된 답변
+20 포인트
잉끼s
8년 전

/lib/shop.lib.php 중

 

</p><p>
// 상품 이미지를 얻는다
function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img_alt='')
{
    global $g5;

    if(!$it_id || !$width)
        return '';

    $sql = " select it_id, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10 from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
    $row = sql_fetch($sql);

    if(!$row['it_id'])
        return '';

    for($i=1;$i<=10; $i++) {
        $file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];
        if(is_file($file) && $row['it_img'.$i]) {
            $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;
        }
    }

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

    if($filename) {
        //thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_height, $is_create, $is_crop=false, $crop_mode='center', $is_sharpen=true, $um_value='80/0.5/3')
        $thumb = thumbnail($filename, $filepath, $filepath, $width, $height, false, true, 'center', false, $um_value='80/0.5/3');
    }

    if($thumb) {
        $file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);
        $img = '<img src="'.$file_url.'" width="'.$width.'" height="'.$height.'" alt="'.$img_alt.'"';
    } else {
        $img = '<img src="'.G5_SHOP_URL.'/img/no_image.gif" width="'.$width.'"';
        if($height)
            $img .= ' height="'.$height.'"';
        $img .= ' alt="'.$img_alt.'"';
    }

    if($img_id)
        $img .= ' id="'.$img_id.'"';
    $img .= '>';

    if($anchor)
        $img = '<a href="'.G5_SHOP_URL.'/item.php?it_id='.$it_id.'">'.$img.'</a>';

    return $img;
}
 </p><p>
 

중에서  

 

$img = ''.$img_alt.'

 

부분이 있습니다. width 랑 height 부분을 지워주세요. 

 

로그인 후 평가할 수 있습니다

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

8년 전

직접 값을 대치해도 됩니다.

 

$this->img_width 대신에 320 같은 방법으로 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

경하귀요밍
8년 전
제가 사이트를 제작할때 반응형웹으로 제작해서 모바일화면이나 테블렛 사이즈에서는 css에 맞게 모바일에선 160 테블렛에선 240 이런식으로 조절되야하는데, 320으로 고정이 되어버리더라구요..ㅜㅜ
경하귀요밍
8년 전
코드에서 직접 주려면 이런 방법도 있다는걸 새로 배워갑니다 ㅎㅎ 감사합니다!

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

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

로그인