게시판리스트와 최신글에 이미지없을때 noimage표시되게하려면~
본문
게시판리스트와 최신글에 이미지없을때 noimage표시되게하려면
어뜨케 하나여?
list.php 파일내용입니다.
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<?
$noIMG = $board_skin_path."/img/noimg.gif"; //[필수](URL)
$max = 88 ; //[필수](픽셀) 썸네일 이미지의 가로세로(긴쪽)의 최대치.
$resol = 70 ; //[필수](퍼센트%) 생성되는 썸네일의 JPG압축률.
$str = 15 ; //[필수](글자수) 썸네일 밑의 제목의 글자수.
function smaller( $W, $H ) {
global $max, $thum_W, $thum_H ;
if ( $W > $H ) { //가로형일 경우.
$thum_W = $max ;
$thum_H = ceil( $H * ( $max / $W ) );
}
if ( $W < $H ) { //세로형일 경우.
$thum_H = $max ;
$thum_W = ceil( $W * ( $max / $H ) );
}
if ( $W == $H ) { //정사각형일 경우.
$thum_W = ceil( $max * 0.8 );
$thum_H = ceil( $max * 0.8 );
}
return $thum_W ;
return $thum_H ;
}
function maker( $thum_W, $thum_H ) {
global $thum, $resol, $ori, $ori_info ;
//$newImg = ImageCreate($thum_W,$thum_H); // GD라이브러리 2.0 (이하일 경우)
$newImg = ImageCreateTrueColor($thum_W,$thum_H); // GD라이브러리 2.0 전용함수
if($ori_info[2]=="2") $origImg=ImageCreateFromjpeg($ori);
if($ori_info[2]=="3") $origImg=ImageCreateFrompng($ori);
//ImageCopyResized($newImg,$origImg,0,0,0,0,$thum_W,$thum_H,ImageSX($origImg),ImageSY($origImg));
imageCopyResampled($newImg,$origImg,0,0,0,0,$thum_W,$thum_H,ImageSX($origImg),ImageSY($origImg));
Imagejpeg($newImg, $thum, $resol );
chmod($thum,0707);
ImageDestroy($newImg);
ImageDestroy($origImg);
return $thum ;
}
?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="<?=$board_skin_path?>/img/box2_tl.gif" border="0" /></td>
<td width="100%" background="<?=$board_skin_path?>/img/box2_tc.gif"></td>
<td><img src="<?=$board_skin_path?>/img/box2_tr.gif" border="0" /></td>
</tr>
<tr>
<td background="<?=$board_skin_path?>/img/box2_ml.gif"></td>
<td style="PADDING:4 4 4 4" valign="top">
<!--/여기부터/-->
<table width="100%" border="0" align="center" cellpadding="14" cellspacing="0" bgcolor="#F7F7F7">
<tr>
<td bgcolor="#FCFCFA"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><? if ($is_category) {
//echo "<table width='100%' cellpadding='0' cellspacing='0' style='margin:0 0 0 0;border:solid #55cc55 1px;'>"; //★ (카테고리목록의 테이블 길이를 100%로 할 경우)
echo "<table width='100%' cellpadding='0' cellspacing='0'>"; //◆
$ca_menu = explode("|",$board[bo_category_list]);
$ca_td_num = "5"; //가로칸수. 원하는 칸수만큼 지정해주면 됩니다.
$ca_td_width = "100%" / $ca_td_num ; //★ <td width='%'>값
for ($c=0, $cnt=count($ca_menu); $c<$cnt; $c++) {
if (($c == "0") || (($c >= $ca_td_num) && ($c % $ca_td_num == "0"))) { echo "<tr>"; }
//echo "<td width='".$ca_td_width."%'>"; //★
echo "<td style='padding:2 10 2 10;'>"; //◆
//★표와 ◆표는 어느 한쪽을 쓸 경우 다른 쪽을 주석처리하면 됩니다.
if ($sca == $ca_menu[$c]) { $bcoral = "<b style='color:#FB6104'>"; } else { $bcoral = ""; }
$sqlCnum = " select count(*) as Cnum from $write_table where wr_is_comment = 0 and ca_name = '$ca_menu[$c]'";
$rowCnum = sql_fetch($sqlCnum);
echo "<a href='".$g4['bbs_path']."/board.php?bo_table=".$bo_table."&sca=".urlencode($ca_menu[$c])."'>";
echo $bcoral.$ca_menu[$c]." <span style='font-size:11px;color:#FB6104;'>[".$rowCnum[Cnum]."]</span></a>";
echo "</td>";
}
echo "</tr></table>";
} ?></td>
</tr>
</table></td>
</tr>
</table>
<!--/여기까지/-->
</td>
<td background="<?=$board_skin_path?>/img/box2_mr.gif"></td>
</tr>
<tr>
<td><img src="<?=$board_skin_path?>/img/box2_bl.gif" border="0" /></td>
<td width="100%" background="<?=$board_skin_path?>/img/box2_bc.gif"></td>
<td><img src="<?=$board_skin_path?>/img/box2_br.gif" border="0" /></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" cellpadding="3">
<tr><td align="right">
<?//=number_format($total_count)?>
<? if ($admin_href) { ?>
<a href="<?=$admin_href?>"><img src="<?=$board_skin_path?>/img/icon_admin.gif" border="0" align="absmiddle"></a>
<? } ?></td>
</tr>
<tr>
<td>
<!------- 지역카테고리별 검색 처리 시작 -->
<div align="right"><br>
<? include "{$board_skin_path}/config.list_select.php"?>
</div>
<?// include "{$board_skin_path}/config.list_select2.php"?>
<!------- 지역카테고리별 검색 처리 끝 -->
</td>
</tr>
</table>
<!--table width="100%" cellpadding="0" cellspacing="0" >
<tr>
<td width="15%" height="1" bgcolor="D63369"></td>
<td width="85%" bgcolor="E7E7E7"></td>
</tr>
<tr>
<td width="15%" height="3" bgcolor="FB974A"></td>
<td width="85%" bgcolor="F7F3F7"></td>
</tr>
</table-->
<!--////-->
<table width="100%" cellpadding="0" >
<tr>
<td><table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="55" height="7"><img src="<?=$board_skin_path?>/img/line_mid_p1.gif"></td>
<td background="<?=$board_skin_path?>/img/line_mid_p5.gif" width="869"></td>
<td width="55"><img src="<?=$board_skin_path?>/img/line_mid_p2.gif"></td>
</tr>
<tr>
<td background="<?=$board_skin_path?>/img/line_mid_p8.gif" width="55"></td>
<td width="869"><table width="100%" cellpadding="5" >
<tr>
<td>
<!--//-->
<table width="100%" cellpadding="0" align="center">
<tr>
<td></td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td valign="top">
<form name="fboardlist" method="post">
<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%" cellpadding="0" cellspacing="0" align="center">
<tr>
<? for ($i=0; $i<count($list); $i++) {
// Thumbnail
$image = urlencode($list[$i][file][0][file]);
$ori="$g4[path]/data/file/$bo_table/" . $image;
$ext = strtolower(substr(strrchr($ori,"."), 1)); //확장자
if ( $ext=="gif"||$ext=="jpg"||$ext=="jpeg"||$ext=="png"||$ext=="bmp"||$ext=="tif"||$ext=="tiff") $ori_info=getimagesize($ori); else $ori_info="";
if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) { //원파일이 [ 2JPG, 2JPEG, 3PNG ] 경우.
$thum = $ori."" ;
if ( file_exists($thum) ) { // Thumbnail [O] 경우
$thum_info = getimagesize ($thum);
$thum_W = $thum_info[0] ;
$thum_H = $thum_info[1] ;
} else { // Thumbnail [X] 경우
if ( smaller( $ori_info[0], $ori_info[1] ) ) {
maker( $thum_W, $thum_H );
}
}
} else if ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) { //원파일이 [ 1GIF,6BMP,7TIF ] 경우.
if ( smaller( $ori_info[0], $ori_info[1] ) ) {
$thum = $ori ;
}
} else { //원파일이 [ 1,2,3,6,7 ] 아닐 경우.
$thum = $noIMG ;
}
?>
<?
$p_four = explode("|",$list[$i][wr_5]);
$four01 = $p_four[0];
$four02 = $p_four[1];
$four03 = $p_four[2];
$four04 = $p_four[3];
$four05 = $p_four[4];
?>
<?//$etc6_exp=explode("|" , $list[wr_6])?>
<?
$p_six = explode("|",$list[$i][wr_6]);
$six01 = $p_six[0];
$six02 = $p_six[1];
$six03 = $p_six[2];
$six04 = $p_six[3];
$six05 = $p_six[4];
$six06 = $p_six[5];
$six07 = $p_six[6];
$six08 = $p_six[7];
$six09 = $p_six[8];
$six10 = $p_six[9];
$six11 = $p_six[10];
$six12 = $p_six[11];
$six13 = $p_six[12];
$six14 = $p_six[13];
$six15 = $p_six[14];
$six16 = $p_six[15];
$six17 = $p_six[16];
$six18 = $p_six[17];
$six19 = $p_six[18];
$six20 = $p_six[19];
$six21 = $p_six[20];
$six22 = $p_six[21];
$six23 = $p_six[22];
$six24 = $p_six[23];
$six25 = $p_six[24];
$six26 = $p_six[25];
$six27 = $p_six[26];
$six28 = $p_six[27];
$six29 = $p_six[28];
$six30 = $p_six[29];
?>
<td height="10" >
<table border="0" cellspacing="0" cellpadding="0" id="table174" align="center">
<tr>
<td>
<table border="0" cellspacing="1" bgcolor="#D9D9D9" cellpadding="3" id="table175" align="center" width="142">
<tr>
<td bgcolor="#FFFFFF" width="134" height="86">
<p align="center">
<a href="<?=$list[$i][href]?>"><img src='<?=$thum?>' alt='상세보기' width="150" border=0 height="100" ></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10" align="center">
<? if ($is_checkbox) { ?>
<p>
<input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>">
<? } ?>
<?=$list[$i][reply]?>
<?=$list[$i][icon_reply]?>
<? if ($list[$i][is_notice]) {?>
<a href="<?=$list[$i][href]?>"><?=$list[$i][subject]?>
</a><? } else {?>
<a href="<?=$list[$i][href]?>"><? if ($four02) echo '<b>';?>
<? if ($four03) echo '<font color="green">';?>
<b><font color="#0066FF"><?=$list[$i][subject]?></font></b>
<? if ($four03) echo '</font>';?>
<? if ($four02) echo '</b>';?>
</a><? }?>
<? if ($list[$i][comment_cnt]) {?>
<a href="<?=$list[$i][comment_href]?>"><font color=#66CC99><?=$list[$i][comment_cnt]?>
<? }?>
<?=$list[$i][icon_new]?>
<?=$list[$i][icon_hot]?>
<? if ($four01)
echo "<img src='$board_skin_path/img/car_icon_1.gif' border='0' align='absmiddle'>";?>
<? if ($four04)
echo "<img src='$board_skin_path/img/car_icon_2.gif' border='0' align='absmiddle'>";?>
<? if ($four05)
echo "<img src='$board_skin_path/img/car_icon_3.gif' border='0' align='absmiddle'>";?>
<br>
<font color="#666666"><?=$list[$i][icon_new]?> <b>[<?=$list[$i][wr_3]?>]</b></font>-<font color="#888888">
<?=$list[$i][wr_4]?>평</font><br></a></font>
<table width="160" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="14"><img src="<?=$board_skin_path?>/img/bicon_04.gif"></td>
<td> <?=$six01?>만원</td>
<td width="14"><img src="<?=$board_skin_path?>/img/bicon_03.gif"></td>
<td> <?=$six03?>만원</td>
</tr>
</table>
</td></tr><tr>
<td >
</td>
</tr>
<tr>
<td height="10"></td>
</tr>
</table></td >
<?php
if($i % 4 == 3){
echo "</tr><tr>";
}
?>
<? } ?>
</tr>
</table>
<? if (count($list) == 0) { echo " <table width=100% border=0 cellpadding=0 cellspacing=0 ><tr><td height=100 align=center> 게시물이 없습니다.</td></tr></table>"; } ?>
</form>
</td>
</tr>
</table>
<!--//-->
</td>
</tr>
</table></td>
<td background="<?=$board_skin_path?>/img/line_mid_p6.gif" width="55"></td>
</tr>
<tr>
<td height="7" width="55"><img src="<?=$board_skin_path?>/img/line_mid_p4.gif"></td>
<td background="<?=$board_skin_path?>/img/line_mid_p7.gif" width="869"></td>
<td width="55"><img src="<?=$board_skin_path?>/img/line_mid_p3.gif"></td>
</tr>
</table></td>
</tr>
</table>
<!--//-->
<table width="100%" cellpadding="3" >
<tr>
<td align="center"><? if ($prev_part_href) {
echo "<a href='$prev_part_href'>
<img src='$board_skin_path/img/search_prev.gif' border=0 align=absmiddle></a>"; } ?>
<?
//echo $write_pages;
$write_pages = str_replace("처음", "<img src='$board_skin_path/img/page_first.gif' border='0' align='absmiddle'>", $write_pages);
$write_pages = str_replace("이전", "<img src='$board_skin_path/img/page_prev.gif' border='0' align='absmiddle'>", $write_pages);
$write_pages = str_replace("다음", "<img src='$board_skin_path/img/page_next.gif' border='0' align='absmiddle'>", $write_pages);
$write_pages = str_replace("맨끝", "<img src='$board_skin_path/img/page_end.gif' border='0' align='absmiddle'>", $write_pages);
$write_pages = preg_replace("/([0-9]*)/", "$1", $write_pages);
$write_pages = preg_replace("/([0-9]*)/", "$1", $write_pages);
?>
<?=$write_pages?>
<? if ($next_part_href) {
echo "<a href='$next_part_href'>
<img src='$board_skin_path/img/search_next.gif' border=0 align=absmiddle></a>"; } ?></td>
</tr>
</table>
<table width="100%" cellpadding="3">
<tr>
<td><? if ($list_href) { ?>
<a href="<?=$list_href?>"><img src="<?=$board_skin_path?>/img/list.gif" border="0" align="absmiddle"></a>
<? } ?>
<? if ($write_href) { ?>
<a href="<?=$write_href?>"><img src="<?=$board_skin_path?>/img/write.gif" border="0" align="absmiddle"></a>
<? } ?>
<? if ($is_checkbox) { ?>
<a href="javascript:select_delete();"><img src="<?=$board_skin_path?>/img/select_delete.gif" border="0" align="absmiddle"></a>
<a href="javascript:select_copy('copy');"><img src="<?=$board_skin_path?>/img/select_copy.gif" border="0" align="absmiddle"></a>
<a href="javascript:select_copy('move');"><img src="<?=$board_skin_path?>/img/select_move.gif" border="0" align="absmiddle"></a>
<? } ?>
<script language="JavaScript">
<!--
function OpenWin(url,intWidth,intHeight){
window.open(url, "ReadSlideShow", "scrollbars=no, resizable=no, width="+intWidth+",height="+intHeight+" ");
return;
}
//-->
</script>
<!--img src="<?=$board_skin_path?>/s_img/bSlideShow.gif" border=0 style="vertical-align: middle;cursor:pointer;" onClick="OpenWin('<?=$board_skin_path?>/slideshow.php?bo_table=<?=$bo_table?>',550,650); return false;" alt="상단 이미지 슬라이드 쇼 보기" title="상단 이미지 슬라이드 쇼 보기"-->
</td>
</tr>
</table></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>
<? 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=396, height=550, scrollbars=1");
f.sw.value = sw;
f.target = "move";
f.action = "./move.php";
f.submit();
}
</script>
<? } ?>
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
이건 또 다른문제인데여
리스트파일하고 뷰파일에서
선택옵션 글자를 수정했더니 오류가 막 그냥 막~
이거 왜 이러는 거져?
답변 2
$noIMG = $board_skin_path."/img/noimg.gif"; //[필수](URL)
여기를
$noIMG = "noimage";
이런식으로 수정하면 됩니다.
게시글에 이미지가 없으면 최신글에도 noimage로 나타나게 해 주세여~
수리수리마수리~