갤러리 게시판 리스트에서 cheditor5로 올린 이미지가 노출이 되게 하고 싶습니다.
본문
갤러리 게시판 리스트 페이지에서 cheditor5로 올린 이미지들이 노출이 되게 하고 싶습니다.
어찌어찌 해봐도 도통 해답이 나오질 않고 있습니다.ㅠㅠ;;;
아래는 list.php파일 소스입니다.
고수님들의 도움 부탁드립니다.^^
------------------------------------------------------------------------------
<?
// 굿빌더 버젼 3.3
// 작성일자: 2013.07.03
// 작성자: 굿빌더, http://www.goodbuilder.co.kr
?>
<?
/// 웹진 형태의 게시판 스킨 good_webzine2_me 버젼 1.0
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("$board_skin_path/skin.lib.php"); //썸네일 이미지 함수
// image width, height
if($board[bo_1] and $board[bo_2] and $board[bo_3]) {
$image_width = $board[bo_1];
$image_height = $board[bo_2];
$image_quality = $board[bo_3];
} else if($g4[default_thumb_width] and $g4[default_thumb_height] and $g4[default_thumb_quality]) {
$image_width = $g4[default_thumb_width];
$image_height = $g4[default_thumb_height];
$image_quality = $g4[default_thumb_quality];
} else {
$image_width = 75;
$image_height = 60;
$image_quality = 100;
}
$image_div_width = $image_width + 7;
$image_div_height = $image_height + 5;
$image_border_style = "style='border:1px solid #dddddd' onmouseover=\"this.style.borderColor='#386eff'\" onmouseout=\"this.style.borderColor='#dddddd'\"";
// 썸네일 저장 디렉터리
$data_path = $g4[path]."/data/file/$bo_table";
/// $thumb_path = $data_path.'/thumbs';
$thumb_path = $data_path.'/thumb';
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 5;
//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
$colspan_minus2 = $colspan - 2; ///***
$title_bg = "#F8F8F9";
$border_bg = "#E5E5E5";
$border_bottom_bg = "#E5E5E5";
// 내용 표시 길이
$content_len = 200;
// 이미지 출력 갯수.
$num_of_images_default = 5;
// 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요.
// <nobr style='display:block; overflow:hidden; width:000px;'>제목</nobr>
?>
<!-- 게시판 목록 시작 -->
<style type="text/css">
<!--
.style9 {color: #CCCCCC}
-->
</style>
<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0><tr><td valign="middle">
<!-- 분류 셀렉트 박스, 게시물 몇건, 관리자화면 링크 -->
<div style="border-top:0px solid #444547; border-bottom:1px solid #d1d1d1; margin-bottom:0px; height:35px; text-align:left;">
<div style="float:left;">
<form method="get" name="fcategory" id="fcategory" style="margin:0px;">
<? if ($is_category) { ?><!--<select name=sca onchange="location='<?=$category_location?>'+<?=strtolower($g4[charset])=='utf-8' ? "encodeURIComponent(this.value)" : "this.value"?>;"><option value=''>전체</option><?=$category_option?></select>--><? } ?><? $ct_sql = "select bo_category_list from g4_board where bo_table = '".$bo_table."'";$ct_rlt = mysql_query($ct_sql);$ct_row = mysql_fetch_array($ct_rlt);$ct_arr = explode("|",$ct_row[bo_category_list]);$count_arr = count($ct_arr);?><a href="./board.php?bo_table=<?=$bo_table?>"><img src='<?=$board_skin_path?>/img/category<?if($sca==''){?>_on<?}?>.jpg' border="0" /></a><? for($a=0; $a<$count_arr; $a++){$ct_img = "category".$a;
if($sca==$ct_arr[$a]){
$ct_img2 = $ct_img."_on.jpg";
}else{
$ct_img2 = $ct_img.".jpg";
}?><a href="./board.php?bo_table=<?=$bo_table?>&sca=<?=$ct_arr[$a]?>"><img src='<?=$board_skin_path?>/img/<?=$ct_img2?>' border="0" /></a><?}?>
</form>
</div>
<br />
<div style="float:right;"><span style="padding-right:5px; padding-top:15px;">
<?=subject_sort_link('wr_hit', $qstr2, 1)?>
<img src='<?=$board_skin_path?>/img/j01.gif' border="0" align="absmiddle"/></a> <span class="style9"> | </span>
<?=subject_sort_link('wr_good', $qstr2, 1)?>
<img src='<?=$board_skin_path?>/img/j02.gif' border="0" align="absmiddle"/></a> <span class="style9"> | </span>
<?=subject_sort_link('wr_comment', $qstr2, 1)?>
<img src='<?=$board_skin_path?>/img/j03.gif' border="0" align="absmiddle"/></a></span>
</div>
</div>
<!-- 제목 -->
<form name="fboardlist" method="post" style="margin:0px;">
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
<input type='hidden' name='sfl' value='<?=$sfl?>'>
<input type='hidden' name='stx' value='<?=$stx?>'>
<input type='hidden' name='spt' value='<?=$spt?>'>
<input type='hidden' name='page' value='<?=$page?>'>
<input type='hidden' name='sw' value=''>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$board_skin_path/img/noimage.gif' border=0 width='$img_width' height='$img_height' title='이미지 없음' align=left style='border:0 solid #cccccc; padding:0px;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
//소스추가 : 에디터로 저장된 사진의 썸네일을 만들기 위함
if(!$list[$i][file][0][file]){
$file = $list[$i]['img'];
$find = strrpos($file,'data');
$file ="../".substr($file,$find);
}
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0707);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0 align=left style='border:1px solid #CCCCCC; padding:0px;'>";
else
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?>
<tr align="center">
<td colspan="3" align="left" style='word-break:break-all; padding-top:2px; padding-bottom:2px;'><br />
<table width="869" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="98" align="center" style=" overflow-y:hidden; ">
<span style=" overflow-y:hidden; ">
<? if($list[$i][ca_name] == "整容苦恼") {
echo "<img src='$board_skin_path/img/1.gif' border=0 >";
} else {
}
?>
<? if($list[$i][ca_name] == "手术后期") {
echo "<img src='$board_skin_path/img/2.gif' border=0 >";
} else {
}
?>
<? if($list[$i][ca_name] == "医院信息") {
echo "<img src='$board_skin_path/img/3.gif' border=0 >";
} else {
}
?>
</span></td>
<td width="4" align="left"><? if ($admin_href) { ?><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>" /><?}?></td>
<td width="559" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><!--체크박스-->
<!--체크박스끝--><span style='font:normal 12px 돋움; color:#a1a1a1; line-height:16px;'><a href='<?=$list[$i][href]?>'><?
$wr_content = preg_replace("/<(.*?)\>/","",$list[$i][wr_content]);
$wr_content = preg_replace("/ /","",$wr_content);
$wr_content = cut_str(get_text($wr_content),275,"..."); //숫자는 최근글에 뽑을 본문길이
echo $wr_content;
?>
</a></span></td>
</tr>
<tr>
<td height="13"></td>
</tr>
<tr>
<td height="80" valign="top"><span style="padding:2px;">
<?
if($list[$i][file][count] < $num_of_images_default)
$num_of_images = $list[$i][file][count];
else
$num_of_images = $num_of_images_default;
for ($j = 0; $j < $num_of_images; $j++) {
/// 보여질 이미지 만들기
$img = "";
$img_size_chk = @getimagesize($g4[path]."/data/file/$bo_table/".$list[$i][file][$j][file]);
if($list[$i][file][$j][file] and $img_size_chk[0] > 0) {
if($j == 0) { $thumb_num = $list[$i][wr_id]; } else { $thumb_num = $list[$i][wr_id]."_".$j; }
$img = makeThumbs($g4[path]."/data/file/$bo_table", $list[$i][file][$j][file], $image_width, $image_height, $list[$i][subject], $image_border_style, $thumb_num);
} else {
$img = "<img src='$board_skin_path/img/noimage.gif' width='$image_width' height='$image_height' title='이미지 없음' $image_border_style>";
}
echo "<a href='{$list[$i][href]}'>$img</a>\n";
}
?>
</span></td>
</tr>
</table></td>
<td width="28"></td>
<td width="150" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><!--체크박스-->
<!--체크박스끝-->
<span class="datetime">
<span class="wdatetime"><font color=#c5c5c5>|</font> <font color=#929292><?php echo $list[$i][wr_datetime]; ?></font></span></span></td>
</tr>
<tr>
<td height="15" align="left"></td>
</tr>
<tr>
<td height="80" align="left" valign="middle">
<span class="hit">
<img src='<?=$board_skin_path?>/img/v01.gif' border="0" align='absmiddle' /> <?=$list[$i][wr_hit]?>
</span>
<span class='comment'><span class="hit"><img src='<?=$board_skin_path?>/img/v02.gif' border="0" align='absmiddle' /> </span>
<?=$list[$i][wr_comment]?></span>
<span class="hit"><img src='<?=$board_skin_path?>/img/v03.gif' border="0" align='absmiddle' /> </span>
<? if ($is_good) { ?><?=$list[$i][wr_good]?><? } ?> </td>
</tr>
</table></td>
</tr>
</table> </td>
</tr>
<tr>
<td width="442" height="1" colspan="<?=$colspan?>" bgcolor="dedede"></td>
</tr>
<?}?>
<? if (count($list) == 0) { echo "<tr><td colspan='$colspan' height=100 align=center>게시물이 없습니다.</td></tr>"; } ?>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
<!-- 페이지 -->
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" align="center" height=0 valign=bottom>
<? if ($prev_part_href) { echo "<a href='$prev_part_href'><img src='$board_skin_path/img/btn_search_prev.gif' border=0 align=absmiddle title='이전검색'></a>"; } ?>
<?
// 기본으로 넘어오는 페이지를 아래와 같이 변환하여 이미지로도 출력할 수 있습니다.
//echo $write_pages;
$write_pages = str_replace("처음", "<img src='$board_skin_path/img/page_begin.gif' border='0' align='absmiddle' title='처음'>", $write_pages);
$write_pages = str_replace("이전", "<img src='$board_skin_path/img/page_prev.gif' border='0' align='absmiddle' title='이전'>", $write_pages);
$write_pages = str_replace("다음", "<img src='$board_skin_path/img/page_next.gif' border='0' align='absmiddle' title='다음'>", $write_pages);
$write_pages = str_replace("맨끝", "<img src='$board_skin_path/img/page_end.gif' border='0' align='absmiddle' title='맨끝'>", $write_pages);
$write_pages = preg_replace("/<span>([0-9]*)<\/span>/", "<b><font style=\"font-family:돋움; font-size:9pt; color:#797979\">$1</font></b>", $write_pages);
$write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<b><font style=\"font-family:돋움; font-size:9pt; color:orange;\">$1</font></b>", $write_pages);
?>
<?=$write_pages?>
<? if ($next_part_href) { echo "<a href='$next_part_href'><img src='$board_skin_path/img/btn_search_next.gif' border=0 align=absmiddle title='다음검색'></a>"; } ?>
</td>
</tr>
</table>
<!-- 링크 버튼, 검색 -->
<form name=fsearch method=get style="margin:0px;">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=sca value="<?=$sca?>">
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td width="50%" height="40">
<? if ($list_href) { ?><a href="<?=$list_href?>"><img src="<?=$board_skin_path?>/img/btn_list.gif" border="0"></a><? } ?>
<? if ($is_checkbox) { ?>
<a href="javascript:select_delete();"><img src="<?=$board_skin_path?>/img/btn_select_delete.gif" border="0"></a>
<a href="javascript:select_copy('copy');"><img src="<?=$board_skin_path?>/img/btn_select_copy.gif" border="0"></a>
<a href="javascript:select_copy('move');"><img src="<?=$board_skin_path?>/img/btn_select_move.gif" border="0"></a>
<? } ?>
<? if ($write_href) { ?><a href="<?=$write_href?>"><img src="<?=$board_skin_path?>/img/btn_write.gif" border="0"></a><? } ?>
</td>
<td width="50%" align="right">
<select name=sfl>
<option value='wr_subject'>제목</option>
<option value='wr_content'>내용</option>
<option value='wr_subject||wr_content'>제목+내용</option>
</select> <input name="stx" class="stx" maxlength="15" itemname="검색어" required value='<?=stripslashes($stx)?>'>
<input type="image" src="<?=$board_skin_path?>/img/btn_search.gif" border='0' align="absmiddle"></td>
</tr>
</table>
</form>
</td></tr></table>
<script language="JavaScript">
if ('<?=$sca?>') document.fcategory.sca.value = '<?=$sca?>';
if ('<?=$stx?>') {
document.fsearch.sfl.value = '<?=$sfl?>';
document.fsearch.sop.value = '<?=$sop?>';
}
</script>
<script language="JavaScript" src="<?="$g4[path]/js/board.js"?>"></script>
<script language="JavaScript">
window.onload=function() {
resizeBoardImage(<?=(int)$board[bo_image_width]?>);
drawFont();
}
</script>
<? if ($is_checkbox) { ?>
<script language="JavaScript">
function all_checked(sw) {
var f = document.fboardlist;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]")
f.elements[i].checked = sw;
}
}
function check_confirm(str) {
var f = document.fboardlist;
var chk_count = 0;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
chk_count++;
}
if (!chk_count) {
alert(str + "할 게시물을 하나 이상 선택하세요.");
return false;
}
return true;
}
// 선택한 게시물 삭제
function select_delete() {
var f = document.fboardlist;
str = "삭제";
if (!check_confirm(str))
return;
if (!confirm("선택한 게시물을 정말 "+str+" 하시겠습니까?\n\n한번 "+str+"한 자료는 복구할 수 없습니다"))
return;
f.action = "./delete_all.php";
f.submit();
}
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fboardlist;
if (sw == "copy")
str = "복사";
else
str = "이동";
if (!check_confirm(str))
return;
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;
f.target = "move";
f.action = "./move.php";
f.submit();
}
</script>
<? } ?>
<!-- 게시판 목록 끝 -->
답변 3
/lib/common.lib.php
// 에디터 이미지 얻기
function get_editor_image($contents, $view=true)
{
if(!$contents)
return false;
// $contents 중 img 태그 추출
if ($view)
$pattern = "/<img([^>]*)>/iS";
else
$pattern = "/<img[^>]*src=[\'\"]?([^>\'\"]+[^>\'\"]+)[\'\"]?[^>]*>/";
preg_match_all($pattern, $contents, $matchs);
return $matchs;
}
알려주신대로 적용했는데, 이번엔 리스트 페이지가 아예 나오질 않고 있어서요..^^;;
common.lib에서 정확히 어느 부분에 넣으면 되는지 알려주시면 감사드리겠습니다~!!