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

혹시 정규식씨 아시는 분 계신가요? 채택완료

머시기거시기 6년 전 조회 1,785

댓글에서 에디터로 올린 이미지를 리스트에서 섬네일로 불러오는데..

 

                  <?php 
                    if (!$list[$i]['is_notice']) {
$query = " select wr_content from ".$write_table." where wr_parent = '".$list[$i]['wr_id']."' and wr_is_comment > 0 "; 
/*여러개의 글 검사 할 때*/
$result = sql_query($query); 
for($j=0; $row = sql_fetch_array($result); $j++) {
   echo get_view_thumbnail($row['wr_content'], $board['bo_gallery_width'], false); 
}
/*여러개의 글 검사 할 때*/

                       //$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);


                        if($thumb['src']) {
                           $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'"  class="list_img">';
                
                        }
                       echo $img_content; 
                       
                       
                    }
                ?>

잘나오긴 하는데 텍스트까지 출력되어 디비에서 확인해보니 

cheditor에 wr_content 안에 이미지 url이 디비에 저장되는 식이더군요,,,

 

그래서 echo get_view_thumbnail($row['wr_content'], $board['bo_gallery_width'], false);  하면

텍스트와 이미지가 함께 출력됩니다.

 

이미지만 섬네일로 뽑아오려면 $row['wr_content'], 를 정규식씨로 해야 한다는거 같은데

문제는 제가 정규식씨를 본적도 없고 1도 모릅니다. 유유

 

도움을 기다려봅니다.

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

답변 1개

채택된 답변
+20 포인트

https://sir.kr/pg_lecture/713">https://sir.kr/pg_lecture/713

sir 에서 검색해도 바로 나와요

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

답변에 대한 댓글 3개

머시기거시기
6년 전
감사합니다만 어떻게 적용할지를 모르겟네요,
릴보이즈
6년 전
get_view_thumbnail 소스 열어봐서 정규식 함수 를 바꿔치기하면되요
머시기거시기
6년 전
감사합니다. 이미지 불러오고 그걸 팝업으로 띄우려니 이렇게 복잡해졌습니다.
되긴 되는데 맞는건지 모르겠습니다.ㅋ

<img style="cursor:pointer;" src=" <?php
if (!$list[$i]['is_notice']) {
$query = " select wr_content from ".$write_table." where wr_parent = '".$list[$i]['wr_id']."' and wr_is_comment > 0 ";

$result = sql_query($query);



for($j=0; $row = sql_fetch_array($result); $j++) {
preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $row['wr_content'],$matches);

echo get_view_thumbnail($matches[1][0], $board['bo_gallery_width'], false);

}

}
?>" onclick="window.open('<?php
if (!$list[$i]['is_notice']) {
$query = " select wr_content from ".$write_table." where wr_parent = '".$list[$i]['wr_id']."' and wr_is_comment > 0 ";

$result = sql_query($query);



for($j=0; $row = sql_fetch_array($result); $j++) {
preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $row['wr_content'],$matches);

echo get_view_thumbnail($matches[1][0], $board['bo_gallery_width'], false);

}


}
?>','asd','scrollbars=yes,width=650,height=750,top=10,left=20');">

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

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

로그인