최신글 첨부파일이 있을때 썸네일이미지가 안나오게 하려면... > 그누4 질문답변

그누4 질문답변

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

최신글 첨부파일이 있을때 썸네일이미지가 안나오게 하려면... 정보

최신글 첨부파일이 있을때 썸네일이미지가 안나오게 하려면...

본문

최신글에 이미지가 없으면 썸네일 없이 글만 나오게 하는게 원하는 바였는데...
사용하다보니깐, 이미지 첨부 안하고, 워드파일을 첨부하니 빈 이미지박스가 나오네요;

첨부파일이 있어도 이미지일때만 썸네일로 나오고, 이미지 아닌 첨부파일이 있을땐
그냥 글만 나오게 하려면 어떻게 해야 하나요? 질문드려요 ^^a...

위에 1번 파일첨부그림이 지금 상태고, 2번 파일첨부한 그림처럼 됐으면 좋겠어요...

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";

include_once("$g4[path]/lib/thumb.lib.php");

$img_width = '160'; //썸네일 가로길이
$img_height = '90'; //썸네일 세로길이
$img_quality = '100'; //퀼리티 100이하로 설정
$data_path = $g4[path]."/data/file/$bo_table";

?>

<table cellpadding=0 cellspacing=0 border="0">

<?
for ($i=0; $i<count($list); $i++) {

$list[$i]['content']=eregi_replace("&nbsp;"," ",$list[$i]['content']);

?>

<? if ( $list[$i][file][0][file] ) {

$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
$img = thumbnail($file, $img_width, $img_height, $img_quality);
$img = "<a href='{$list[$i][href]}'><img src='$img' width='$img_width' height='$img_height' border='0' style='border:2 #eee solid' onmouseover=this.style.filter='alpha(opacity=60)' onmouseout=this.style.filter='' title='{$list[$i][subject]}'></a>";

 ?>
<tr>
    <td colspan="9" height="1" background="<?=$latest_skin_path?>/img/dot_bg.gif"></td>
 </tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>
  <td width="160" height="90" rowspan="3"><a href='<?=$list[$i][href]?>'><?=$img?></a> </td>
<td width="900" style="padding:0 10px 0 10px"> <a href='<?=$list[$i]['href']?>' style='color:#285386;font-size:10pt;font-weight:bold;'><B><?=$list[$i]['subject']?></B>
<span style="color:#FF6633;font-size:7pt;background-image:url('<?=$latest_skin_path?>/img/comment.gif');background-repeat:no-repeat;background-position:center top;">
<?=$list[$i]['comment_cnt']?></span></a>
</td>
</tr>
<tr>
<td width="900" style="padding:0 10px 0 10px;"><?=$list[$i]["name"]?><span style="color:#dddddd">|</span>
<span style="font-size:9pt;"><?=substr($list[$i][wr_datetime],0,10)." (".get_yoil($list[$i][wr_datetime]).") ".substr($list[$i][wr_datetime],11,5)?></span>
<span style="color:#dddddd">|</span> <?=$list[$i][bo_subject]?></td>
</tr>
<tr>
<td width="900" style="padding:0 10px 0 10px;"><a href="<?=$list[$i]['href']?>">
<span style="color:#666666;"><?=conv_subject($list[$i]['content'], 200, $cutopt='...')?></span></a></td>
</tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>

<? } else { ?>
<tr>
    <td colspan="9" height="1" background="<?=$latest_skin_path?>/img/dot_bg.gif"></td>
 </tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>
<td colspan="2" height="15" style="padding:0 10px 0 10px">
<a href='<?=$list[$i]['href']?>' style='color:#285386;font-size:10pt;font-weight:bold;'><B><?=$list[$i]['subject']?></B>
<span style="color:#FF6633;font-size:7pt;background-image:url('<?=$latest_skin_path?>/img/comment.gif');background-repeat:no-repeat;background-position:center top;">
<?=$list[$i]['comment_cnt']?></span></a></td>
</tr>
<tr>
<td colspan="2" style="padding:0 10px 0 10px"><?=$list[$i]["name"]?><span style="color:#dddddd">|</span>
<span style="font-size:9pt;"><?=substr($list[$i][wr_datetime],0,10)." (".get_yoil($list[$i][wr_datetime]).") ".substr($list[$i][wr_datetime],11,5)?></span>
<span style="color:#dddddd">|</span> <?=$list[$i][bo_subject]?></td>
</tr>
<tr>
<td colspan="2" style="padding:0 10px 0 10px"><a href="<?=$list[$i]['href']?>">
<span style="color:#666666;"><?=conv_subject($list[$i]['content'], 230, $cutopt='...')?></span></a></td>
</tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>
<? } ?><? } ?>

<? if (count($list) == 0) { ?><tr><td align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>

</table>

댓글 전체

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";

include_once("$g4[path]/lib/thumb.lib.php");

$img_width = '160'; //썸네일 가로길이
$img_height = '90'; //썸네일 세로길이
$img_quality = '100'; //퀼리티 100이하로 설정
$data_path = $g4[path]."/data/file/$bo_table";

?>

<table cellpadding=0 cellspacing=0 border="0">

<?
for ($i=0; $i<count($list); $i++) {

$list[$i]['content']=eregi_replace("&nbsp;"," ",$list[$i]['content']);

?>

<? if ( $list[$i][file][0][file] ) {

$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
$img = thumbnail($file, $img_width, $img_height, $img_quality);
$img = "<a href='{$list[$i][href]}'><img src='$img' width='$img_width' height='$img_height' border='0' style='border:2 #eee solid' onmouseover=this.style.filter='alpha(opacity=60)' onmouseout=this.style.filter='' title='{$list[$i][subject]}'></a>";
 ?>
<tr>
    <td colspan="9" height="1" background="<?=$latest_skin_path?>/img/dot_bg.gif"></td>
 </tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>





<? if($file) { ?>
<tr>
  <td width="160" height="90" rowspan="3"><a href='<?=$list[$i][href]?>'><?=$img?></a> </td>
<td width="900" style="padding:0 10px 0 10px"> <a href='<?=$list[$i]['href']?>' style='color:#285386;font-size:10pt;font-weight:bold;'><B><?=$list[$i]['subject']?></B>
<span style="color:#FF6633;font-size:7pt;background-image:url('<?=$latest_skin_path?>/img/comment.gif');background-repeat:no-repeat;background-position:center top;">
<?=$list[$i]['comment_cnt']?></span></a>
</td>
</tr>
<tr>
<td width="900" style="padding:0 10px 0 10px;" valign="top"><?=$list[$i]["name"]?><span style="color:#dddddd">|</span>
<span style="font-size:9pt;"><?=substr($list[$i][wr_datetime],0,10)." (".get_yoil($list[$i][wr_datetime]).") ".substr($list[$i][wr_datetime],11,5)?></span>
<span style="color:#dddddd">|</span> <?=$list[$i][bo_subject]?></td>
</tr>
<tr>
<td width="900" style="padding:0 10px 0 10px;" valign="top"><a href="<?=$list[$i]['href']?>">
<span style="color:#666666;"><?=conv_subject($list[$i]['content'], 200, $cutopt='...')?></span></a></td>
</tr>
<? } else { ?>
<tr>
  <td height="50" colspan="2" valign="top">&nbsp; <a href='<?=$list[$i]['href']?>' style='color:#285386;font-size:10pt;font-weight:bold;'><B><?=$list[$i]['subject']?></B>
<span style="color:#FF6633;font-size:7pt;background-image:url('<?=$latest_skin_path?>/img/comment.gif');background-repeat:no-repeat;background-position:center top;">
<?=$list[$i]['comment_cnt']?></span></a>
&nbsp;&nbsp;&nbsp;&nbsp;
<?=$list[$i]["name"]?><span style="color:#dddddd">|</span>
<span style="font-size:9pt;"><?=substr($list[$i][wr_datetime],0,10)." (".get_yoil($list[$i][wr_datetime]).") ".substr($list[$i][wr_datetime],11,5)?></span>
<br />
<a href="<?=$list[$i]['href']?>">
<span style="color:#666666;"><?=conv_subject($list[$i]['content'], 200, $cutopt='...')?></span></a>
</td>
</tr>
<? } ?>







<tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>

<? } else { ?>
<tr>
    <td colspan="9" height="1" background="<?=$latest_skin_path?>/img/dot_bg.gif"></td>
 </tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>
<td colspan="2" height="15" style="padding:0 10px 0 10px">
<a href='<?=$list[$i]['href']?>' style='color:#285386;font-size:10pt;font-weight:bold;'><B><?=$list[$i]['subject']?></B>
<span style="color:#FF6633;font-size:7pt;background-image:url('<?=$latest_skin_path?>/img/comment.gif');background-repeat:no-repeat;background-position:center top;">
<?=$list[$i]['comment_cnt']?></span></a></td>
</tr>
<tr>
<td colspan="2" style="padding:0 10px 0 10px"><?=$list[$i]["name"]?><span style="color:#dddddd">|</span>
<span style="font-size:9pt;"><?=substr($list[$i][wr_datetime],0,10)." (".get_yoil($list[$i][wr_datetime]).") ".substr($list[$i][wr_datetime],11,5)?></span>
<span style="color:#dddddd">|</span> <?=$list[$i][bo_subject]?></td>
</tr>
<tr>
<td colspan="2" style="padding:0 10px 0 10px"><a href="<?=$list[$i]['href']?>">
<span style="color:#666666;"><?=conv_subject($list[$i]['content'], 230, $cutopt='...')?></span></a></td>
</tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>
<? } ?><? } ?>

<? if (count($list) == 0) { ?><tr><td align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>

</table>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";

include_once("$g4[path]/lib/thumb.lib.php");

$img_width = '160'; //썸네일 가로길이
$img_height = '90'; //썸네일 세로길이
$img_quality = '100'; //퀼리티 100이하로 설정
$data_path = $g4[path]."/data/file/$bo_table";

?>

<table cellpadding=0 cellspacing=0 border="0">

<?
for ($i=0; $i<count($list); $i++) {

$list[$i]['content']=eregi_replace("&nbsp;"," ",$list[$i]['content']);

?>

<?
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
$img_src = @getimagesize($file);
 if ( $list[$i][file][0][file] && $img_src[2] ) {
$img = thumbnail($file, $img_width, $img_height, $img_quality);
$img = "<a href='{$list[$i][href]}'><img src='$img' width='$img_width' height='$img_height' border='0' style='border:2 #eee solid' onmouseover=this.style.filter='alpha(opacity=60)' onmouseout=this.style.filter='' title='{$list[$i][subject]}'></a>";

 ?>
<tr>
    <td colspan="9" height="1" background="<?=$latest_skin_path?>/img/dot_bg.gif"></td>
 </tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>
  <td width="160" height="90" rowspan="3"><a href='<?=$list[$i][href]?>'><?=$img?></a> </td>
<td width="900" style="padding:0 10px 0 10px"> <a href='<?=$list[$i]['href']?>' style='color:#285386;font-size:10pt;font-weight:bold;'><B><?=$list[$i]['subject']?></B>
<span style="color:#FF6633;font-size:7pt;background-image:url('<?=$latest_skin_path?>/img/comment.gif');background-repeat:no-repeat;background-position:center top;">
<?=$list[$i]['comment_cnt']?></span></a>
</td>
</tr>
<tr>
<td width="900" style="padding:0 10px 0 10px;"><?=$list[$i]["name"]?><span style="color:#dddddd">|</span>
<span style="font-size:9pt;"><?=substr($list[$i][wr_datetime],0,10)." (".get_yoil($list[$i][wr_datetime]).") ".substr($list[$i][wr_datetime],11,5)?></span>
<span style="color:#dddddd">|</span> <?=$list[$i][bo_subject]?></td>
</tr>
<tr>
<td width="900" style="padding:0 10px 0 10px;"><a href="<?=$list[$i]['href']?>">
<span style="color:#666666;"><?=conv_subject($list[$i]['content'], 200, $cutopt='...')?></span></a></td>
</tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>

<? }} else { ?>
<tr>
    <td colspan="9" height="1" background="<?=$latest_skin_path?>/img/dot_bg.gif"></td>
 </tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>
<td colspan="2" height="15" style="padding:0 10px 0 10px">
<a href='<?=$list[$i]['href']?>' style='color:#285386;font-size:10pt;font-weight:bold;'><B><?=$list[$i]['subject']?></B>
<span style="color:#FF6633;font-size:7pt;background-image:url('<?=$latest_skin_path?>/img/comment.gif');background-repeat:no-repeat;background-position:center top;">
<?=$list[$i]['comment_cnt']?></span></a></td>
</tr>
<tr>
<td colspan="2" style="padding:0 10px 0 10px"><?=$list[$i]["name"]?><span style="color:#dddddd">|</span>
<span style="font-size:9pt;"><?=substr($list[$i][wr_datetime],0,10)." (".get_yoil($list[$i][wr_datetime]).") ".substr($list[$i][wr_datetime],11,5)?></span>
<span style="color:#dddddd">|</span> <?=$list[$i][bo_subject]?></td>
</tr>
<tr>
<td colspan="2" style="padding:0 10px 0 10px"><a href="<?=$list[$i]['href']?>">
<span style="color:#666666;"><?=conv_subject($list[$i]['content'], 230, $cutopt='...')?></span></a></td>
</tr>
  <tr>
<td colspan="2"  width="454" height="5"></td>
</tr>
<tr>
<? } ?><? } ?>

<? if (count($list) == 0) { ?><tr><td align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>

</table>
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
$img_src = @getimagesize($file);
 if ( $list[$i][file][0][file] && $img_src[2] ) {

를 설명하자면 $file의 이미지 크기를 구합니다.
$img_src 에 배열로 [0] 가로 , [1] 세로, [2] 이미지유형(jpg,gif...)
그리고 이미지 유형이 잇다면 이미지를 표시합니다 ^^
전체 66,558 |RSS
그누4 질문답변 내용 검색

회원로그인

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