게시판 이미지 노출 관련 질문입니다..!

게시판 이미지 노출 관련 질문입니다..!

QA

게시판 이미지 노출 관련 질문입니다..!

본문

2039367193_1671416918.176.png

 

다음과 같이 특정 조건에 만족하는 데이터를 따로 불러오고 있습니다.

 

sql문 내부에서 for문으로 작동하고 있고, get_list_thumbnail이나 get_view_thumbnail 함수는 사용하지 않고 있습니다.

 

대신 에디터에서 직접적으로 이미지 소스만 불러오는 get_editor_image (/common.lib) 함수를 쓰고 있지요..

 

다 좋은데..

 

이미지의 width, height를 조정할 수 있는 방법이 따로 없을까요?

 

사용한 소스코드는 다음과 같습니다!

 



<?php
$sql = " SELECT t.wr_subject, t.wr_content, t.wr_1, t.wr_2, t.wr_hit, t.mb_id, t.wr_name, m.mb_id, m.mb_nick, t.ca_name, t.wr_id FROM `g5_write_trade` AS t, `g5_member` AS m WHERE t.mb_id = m.mb_id AND t.wr_name = m.mb_nick AND t.wr_subject != '' ";

$res = sql_query($sql);

for ($i = 0; $row = sql_fetch_array($res); $i++) {
    $thumb = get_editor_image($row['wr_content'], true);

    if ($member['mb_id'] == $row['mb_id']) {
        echo '<br>';
        echo '<p><strong>' . $row['wr_subject'] . '</strong></p>';
        echo '<p>' . $thumb[0][0] . '</p>';
        echo '<p>' . $row['mb_nick'] . '</p>';
        if ($row['ca_name'] == '중고거래') {
            echo '<p><strong>' . number_format($row['wr_1']) . '원</strong></p>';
        } elseif ($row['ca_name'] == '나눔거래') {
            echo '';
        }
        echo '<p>' . $row['wr_2'] . '</p>';
        echo '<p>조회수 ' . $row['wr_hit'] . '</p>';
        echo '<br>';
    }
}
?>

 

$thumb[0][0] 에서 이미지를 불러오고 있습니다.

 


<img src="http://kidspark.co.kr/data/editor/2212/5f49cefdcecd5bfcfc0e35817232e3f6_1670931265_1246.jpg" title="5f49cefdcecd5bfcfc0e35817232e3f6_1670931265_1246.jpg">

 

 

이 질문에 댓글 쓰기 :

답변 3

 다음처럼 하면 되지만 가로 세로 이미지 크기를 강제로 지정하면 비율이 문제가 됩니다


$thumb = get_editor_image($row['wr_content'], true);
$srcArr=array('width', 'height', '>')
$targArr=array('data-width','data-height',' width=300 height=200>'); 
 $thumb[0][0] = str_replace($srcArr, $targArr, $thumb[0][0]);

===============

delete_editor_thumbnail 함수를 참고해서 get_editor_thumbnail 함수를 만들고

가로 또는 세로 크기를 구해서 비율을 맞추어 출력하는 코드를 넣어야할 것으로 보입니다

아니면 get_view_thumbnail 함수를 참고해서 설정하는 크기로 썸네일 만드는 코드를 만드는 것이 좋겟습니다

 

 

 

get_editor_image 함수로는 이미지 크기를 조절할 수 없습니다.

get_list_thumbnail, get_view_thumbnail 함수를 사용할시 좌우높이값을 함수에 넣을 수 있습니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 123,590 | RSS
QA 내용 검색

회원로그인

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