첨부파일이 아닌 에디터로 삽입한 첫번째 이미지를 리스트에 출력하는 법. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

첨부파일이 아닌 에디터로 삽입한 첫번째 이미지를 리스트에 출력하는 법. 정보

첨부파일이 아닌 에디터로 삽입한 첫번째 이미지를 리스트에 출력하는 법.

첨부파일

list.skin.php (17.7K) 9회 다운로드 2007-07-24 00:23:55
list.skin.php (16.2K) 5회 다운로드 2007-07-24 00:23:55
list.skin.php (11.1K) 4회 다운로드 2007-07-24 00:23:55

본문

제목 그대로 cheditor 에서, 또는 html 코드를 이용하여 <img src="어쩌구 저쩌구"> 라고 사용하여
내용에 이미지를 삽입했을 경우( html 사용이 가능하고 에디터 모드가 아닌 일반 글쓰기 모드.. 또는 에디터 모드에서 ) 리스트에 이미지가 출력되는 방법을 찾습니다.


예전에는 게시판이 에디터보다는 텍스트 위주이다 보니 첫번째 첨부파일 이미지를 리스트에 출력한것 같습니다.

첫번째 첨부파일은 제가 사용하는 이미지 게시판이고
두번째와 세번째 첨부파일은 말씀드린 방식으로 동작이 되고 있는 게시판 입니다.

코드를 아무리 보고 이리 붙여보고 저리붙여봐도 에러만 나고 되지를 않습니다. ㅜ.ㅡ
php를 알지를 못하니.. 흙 ㅜ.ㅡ

"  부분이 이래서 문제인것 같고 이 부분을 어떻게 수정해야 하죠? " 라고 질문을 드릴 능력조차 되지 않아서
감히 조심스럽게 첨부파일로 질문을 드립니다.

두번째 와 세번째 파일의 경우는 첨부파일이 이미지일 경우 출력하고 이미지가 아닐경우에는 내용에 들어있는 이미지 중 첫번째 이미지를 출력하는경우인데

두번째는 첨부파일 이미지가 아닐경우에는 썸네일을 생성하지 않는것 같습니다.

썸네일로 생성이 되는것은 세번째 첨부파일인것 같아서 해보았는데 .. ㅜ.ㅡ

어떻게 해야할지 도움좀 부탁드립니다.
너무 장황하고 핵심적인 내용을 기재하지 못해서 죄송합니다.

댓글 전체

제가 사용하는 latest.skin.php 들중 하나를 그냥 그대로 올려봅니다.

<?
if (!defined("_GNUBOARD_")) exit;
include_once "$g4[path]/mkthumb/mkthumb.php";
$thumb_width=80;//섬네일 최대폭
$thumb_height=80;//섬네일 최대높이
?>

<table width=215 align=center cellpadding=0 cellspacing=0>
<tr><td colspan=3><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src='<?=$latest_skin_path?>/img/<?=$bo_table?>_more.gif' border=0></a></td></tr>

<? for ($i=0; $i<count($list); $i++) { ?>
<? if ($i==0){?>
<tr>
<?
$pos1= stristr($list[$i][wr_content],'<IMG');
$pos2= strpos($pos1,'>');
$result1= stristr(substr($pos1,0,$pos2+1),'http');
$pos3= strpos($result1,'"');
$thumbsource= stristr(substr($result1,0,$pos3),'http');
?>
<? if ($thumbsource) { ?>
<td valign=top>
<?
$thumbimg=$g4[path] . "/data/file/" . $bo_table . "/angul_" . $list[$i][wr_id].".thumb";
get_ThumbnailFromHTMLTag($thumb_width,$thumb_height,$thumbsource,$thumbimg);
@chmod($thumbimg, 0707);
$thum_img = "<img src='$thumbimg' width='".$thumb_width."' height='".$thumb_height."' style='border:1 #E7E7E7 solid' title='[{$list[$i][ca_name]}] {$list[$i][subject]}'>";
echo "<a href='{$list[$i][href]}'>$thum_img</a>";
?>
</td>
<? }else{?>
<!-----------첫번째 첨부파일에 이미지가 있으면 이미지 출력 //---------------->
<td valign=top>
<?               
            $image = urlencode($list[$i][file][0][file]);
            if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
            $thumbsource=$g4[path] . "/data/file/" . $bo_table . "/" .$image;
            $thumbimg=$g4[path] . "/data/file/" . $bo_table ."/angul_" . $list[$i][wr_id].".thumb";
            make_thumb($thumb_width,$thumb_height,$thumbsource,$thumbimg);
            @chmod($thumbimg, 0707);
            $thum_img = "<img src='$thumbimg' width='".$thumb_width."' height='".$thumb_height."' style='border:1 #E7E7E7 solid' title='[{$list[$i][ca_name]}] {$list[$i][subject]}'>";
        echo "<a href='{$list[$i][href]}'>$thum_img</a>";
            } else
        echo "<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/noimage.gif' width='$thumb_width' height='$thumb_height'  border=1 style='border-color:d1d1d1;' align=left hspace=10 vspace=0></a>";
?>
</td>
<? }?>
<? }else if ($i==1){?>

<?
$pos1= stristr($list[$i][wr_content],'<IMG');//첫번째 여는 이미지 태그부터 pos1에 담고
$pos2= strpos($pos1,'>');//첫번째 닫는 태그의 위치를 잡는다.
$result1= stristr(substr($pos1,0,$pos2+1),'http');
$pos3= strpos($result1,'"');
$thumbsource= stristr(substr($result1,0,$pos3),'http');
?>
<? if ($thumbsource) { ?>
<td valign=top>
<?
$thumbimg=$g4[path] . "/data/file/" . $bo_table . "/angul_" . $list[$i][wr_id].".thumb";
get_ThumbnailFromHTMLTag($thumb_width,$thumb_height,$thumbsource,$thumbimg);
@chmod($thumbimg, 0707);
$thum_img = "<img src='$thumbimg' width='".$thumb_width."' height='".$thumb_height."' style='border:1 #E7E7E7 solid' title='[{$list[$i][ca_name]}] {$list[$i][subject]}'>";
echo "<a href='{$list[$i][href]}'>$thum_img</a>";
?>
</td>
<? }else{?>
<!-----------첫번째 첨부파일에 이미지가 있으면 이미지 출력 //---------------->
<td valign=top>
<?               
            $image = urlencode($list[$i][file][0][file]);
            if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
            $thumbsource=$g4[path] . "/data/file/" . $bo_table . "/" .$image;
            $thumbimg=$g4[path] . "/data/file/" . $bo_table ."/angul_" . $list[$i][wr_id].".thumb";
            make_thumb($thumb_width,$thumb_height,$thumbsource,$thumbimg);
            @chmod($thumbimg, 0707);
            $thum_img = "<img src='$thumbimg' width='".$thumb_width."' height='".$thumb_height."' style='border:1 #E7E7E7 solid' title='[{$list[$i][ca_name]}] {$list[$i][subject]}'>";
        echo "<a href='{$list[$i][href]}'>$thum_img</a>";
            } else
        echo "<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/noimage.gif' width='$thumb_width' height='$thumb_height'  border=1 style='border-color:d1d1d1;' align=left hspace=10 vspace=0></a>";
?>
</td>
<? }?>
</tr>
<? }else{?>
<tr><td colspan=3 height=5></td></tr>


<tr>
    <td colspan=3 align=center>
        <table width=100% cellpadding=0 cellspacing=0>
        <tr>
            <td height=20 style='padding-left:10px;'><img src='<?=$latest_skin_path?>/img/latest_icon.gif' align=absmiddle>&nbsp;
            <?
            echo $list[$i]['icon_reply'] . " ";
            echo "<a href='{$list[$i]['href']}'>";
            if ($list[$i]['is_notice'])
                echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
            else
                echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>";
            echo "</a>";


            ?></td></tr>
        <tr><td height=5><img src='<?=$latest_skin_path?>/img/dot_line.gif'></td></tr>
        </table></td>
</tr>
<? } ?>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>

</table>
감사합니다. 일단 제가 지금 자야하는 상황이라서 지금은 못해보고 내일 테스트 해보겠습니다.

어차피 코드를 본다 하여도... 에휴.. ㅜ.ㅡ 그래도 정말 감사합니다.
보여주신 코드로 열심히 삽질하여 성공하면 감사의 말씀 드릴께요. ( 마구 붙여보다 보면 될지도.. -_-;;; 디자이너의 비애.. 추륵 ㅜ.ㅡ )
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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