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

latest 게시판 썸네일을 배경 스타일로 불러 들이는 거요~ 채택완료

홀로그램웹 11개월 전 조회 1,597

<div class="sct_img" style="<?php echo run_replace('thumb_image_tag', $img_content, $thumb); ?>">

이 부분인데요

이미지 형태가 아니라 배경으로 썸네일이 나오게 하고 싶은데 저걸 어떻게 수정해야 하나요?

 

 

</p>

<p><?php

if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

include_once(G5_LIB_PATH.'/thumbnail.lib.php');</p>

<p>// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨

add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);

$thumb_width = 350;

$thumb_height = 300;

$list_count = (is_array($list) && $list) ? count($list) : 0;

?></p>

<p><!----- BEST ART 슬라이드 MAX 12개 (4개씩 묶음이동) ----->

<section class="best">

    <div class="best-slider-wrap" data-aos="fade-up">

        <!-- 메인상품진열 시작 { -->

        <div class="best-slider">

            <ul class="swiper-wrapper sct sct_20">

                <?php

                for ($i=0; $i<$list_count; $i++) {

                $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);</p>

<p>                if($thumb['src']) {

                    $img = $thumb['src'];

                } else {

                    $img = G5_IMG_URL.'/no_img.png';

                    $thumb['alt'] = '이미지가 없습니다.';

                }

                $img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';

                ?>

                

                <li class="swiper-slide sct_li">

                    <a href="<?php echo $list[$i]['href'] ?>" >

                    <div class="li_wr">

                        <div class="sct_img_wrap">

                            <div class="sct_img" style="<?php echo run_replace('thumb_image_tag', $img_content, $thumb); ?>">

                                

                            </div>

                        </div>

                        <div class="sct_desc"><span><?php echo $list[$i]['ca_name'] ?></span>

                            <p><?php echo $list[$i]['wr_4'] ?></p>

                        </div>

                        <div class="sct_cost">52%<span class="price_cost"><strong><?php echo $list[$i]['wr_5'] ?></strong>원</span>

                        </div>

                    </div>

                    </a>

                </li>

                <?php }  ?>

        

        <?php if ($list_count == 0) { //게시물이 없을 때  ?>

            준비중

        <?php }  ?>

            </ul>

        </div>

        <div class="swiper-button-prev cursor-able"></div>

        <div class="swiper-button-next cursor-able"></div>

        <div class="swiper-pagination"></div><!-- } 상품진열 끝 -->

    </div>

</section></p>

<p>  </p>

<p>

 

 

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

답변 2개

채택된 답변
+20 포인트
glitter0gim
11개월 전

※ 스타일에 background-image로 변경한 구문을 추가하세요.

</p>

<p><div class="sct_img" style="background-image: url('<?php echo $img; ?>'); background-size: cover; background-position: center;"></p>

<p>

  - 이미지를 조절하느냐/추가하느냐의  차이 아닐까요?

 

♣ $img $thumb['alt'] 다음에 - 아래의 코드로-

  글쓴이의 url이 잘 담겼는 지 확인 하세요.

</p>

<p><?php

// 디버깅 정보 출력

echo "<p>글쓴이 URL - " . htmlspecialchars($img) . "</p>";

echo "<p>이미지_Tag의 ALT - " . htmlspecialchars($thumb['alt']) . "</p>";</p>

<p>

  

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

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

11개월 전

style 내부에 background:url("<?=run_replace('thumb_image_tag', $img_content, $thumb); ?>") no-repeart 넣어서해보세요

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

답변에 대한 댓글 6개

홀로그램웹
11개월 전
<div class="sct_img" style="<?=run_replace('thumb_image_tag', $img_content, $thumb); ?>"> 안됩니다 ㅠㅠ
리오닥터
11개월 전
아뇨 백그라운드 로 깔아줘야되요 background:url을 스타일내부에 있어야되요
홀로그램웹
11개월 전
<div class="sct_img" style="background:url("<?=run_replace('thumb_image_tag', $img_content, $thumb); ?>") no-repear"> 머 하나가 잘못 써졌나봐요 no-repear"> 이 부분이 인터넷에 그대로 나오더라구요~
리오닥터
11개월 전
no-repeat; 이거 에요
리오닥터
11개월 전
그리고 가로 세로 사이즈도 넣어주시구요
홀로그램웹
11개월 전
css 잘못된건 제가 잡았는데도 안되더라구요~php 안에서 열고 닫는 그 부분에서 머가 잘못 되서 안되는 것 같아유

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

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

로그인