채택완료

혹시 정규식씨 아시는 분 계신가요?

2019-08-04 (일) 18:16:21 1,972

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

                  <?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개 / 댓글 3개

채택된 답변
+20 포인트
2019-08-04 (일) 20:17:01

https://sir.kr/pg_lecture/713

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

답변에 대한 댓글 3개

2019-08-05 (월) 04:06:26
감사합니다만 어떻게 적용할지를 모르겟네요,
get_view_thumbnail 소스 열어봐서 정규식 함수 를 바꿔치기하면되요
2019-08-05 (월) 22:10:19
감사합니다. 이미지 불러오고 그걸 팝업으로 띄우려니 이렇게 복잡해졌습니다.
되긴 되는데 맞는건지 모르겠습니다.ㅋ

<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');">

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