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

get_it_image 함수에 class 또는 style 넣는 방법좀 부탁드려요 채택완료

AntonyPang 8년 전 조회 4,863

</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>

 

 

위 함수에서 style 또는 class를 어떤 형식으로 넣어야 적용이될까요

이래저래 넣어봐도 무조건 오류가 나와서 ㅠㅠ너무힘드네요

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

답변 1개

채택된 답변
+20 포인트
o
8년 전

get_it_image 함수는 /lib/shop.lib.php 파일안에 있습니다. 

 

</p><p>// 상품 이미지를 얻는다</p><p>function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img_alt='')</p><p>{</p><p>    global $g5;</p><p> </p><p>    if(!$it_id || !$width)</p><p>        return '';</p><p> </p><p>    $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' ";</p><p>    $row = sql_fetch($sql);</p><p> </p><p>    if(!$row['it_id'])</p><p>        return '';</p><p> </p><p>    for($i=1;$i<=10; $i++) {</p><p>        $file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];</p><p>        if(is_file($file) && $row['it_img'.$i]) {</p><p>            $size = @getimagesize($file);</p><p>            if($size[2] < 1 || $size[2] > 3)</p><p>                continue;</p><p> </p><p>            $filename = basename($file);</p><p>            $filepath = dirname($file);</p><p>            $img_width = $size[0];</p><p>            $img_height = $size[1];</p><p> </p><p>            break;</p><p>        }</p><p>    }</p><p> </p><p>    if($img_width && !$height) {</p><p>        $height = round(($width * $img_height) / $img_width);</p><p>    }</p><p> </p><p>    if($filename) {</p><p>        //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')</p><p>        $thumb = thumbnail($filename, $filepath, $filepath, $width, $height, false, true, 'center', false, $um_value='80/0.5/3');</p><p>    }</p><p> </p><p>    if($thumb) {</p><p>        $file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);</p><p>        $img = '<img src="'.$file_url.'" width="'.$width.'" height="'.$height.'" alt="'.$img_alt.'"';</p><p>    } else {</p><p>        $img = '<img src="'.G5_SHOP_URL.'/img/no_image.gif" width="'.$width.'"';</p><p>        if($height)</p><p>            $img .= ' height="'.$height.'"';</p><p>        $img .= ' alt="'.$img_alt.'"';</p><p>    }</p><p> </p><p>    if($img_id)</p><p>        $img .= ' id="'.$img_id.'"';</p><p>    $img .= '>';</p><p> </p><p>    if($anchor)</p><p>        $img = '<a href="'.G5_SHOP_URL.'/item.php?it_id='.$it_id.'">'.$img.'</a>';</p><p> </p><p>    return $img;</p><p> </p><p>}</p><p>

 

 

위 코드기준 52라인 전에 아래처럼 추가해보세요.

...

if($img_id)

    $img .= ' id="'.$img_id.'"';

$img .= 'class="클래스이름"';

$img .= 'style="스타일코드"'; 

$img .= '>';

if($anchor) 

...

 

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

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

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

로그인