최신글 이미지 없을경우 노이미지 소스는 어떻게 넣나요? > 그누4 질문답변

그누4 질문답변

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

최신글 이미지 없을경우 노이미지 소스는 어떻게 넣나요? 정보

최신글 이미지 없을경우 노이미지 소스는 어떻게 넣나요?

본문

아래는 latest.skin.php 파일입니다.
--------------------------------------

<?php

if(defined('_GNUBOARD_') == false)
{
exit();
}

if(defined('_PLUGIN_') == false)
{
define('_PLUGIN_', true);
include_once($latest_skin_path . '/latest.lib.php');
echo "<script type=\"text/javascript\">\n";
echo "var COUNT = new Array();\n";
echo "function layer(id, no)\n";
echo "{\n";
echo "for(var i = 0; i < COUNT[id]; i++) document.getElementById(id + \"_\" + i).style.display = \"none\";\n";
echo "document.getElementById(id + \"_\" + no).style.display = \"block\";\n";
echo "return;\n";
echo "}\n";
echo "</script>";
}

list($width, $height, $default) = explode(',', $options);

?>

<script type="text/javascript">COUNT["<?php echo $bo_table; ?>"] = <?php echo count($list); ?>;</script>

<table width="276" align="center" cellpadding="0" cellspacing="0">

<tr>
    <td style="padding-left:8; padding-left:10; border-top-width:1; border-right-width:0; border-bottom-width:1; border-left-width:1; border-top-color:silver; border-right-color:black; border-bottom-color:silver; border-left-color:silver; border-style:solid;" height="30" bgcolor="#FFFFFF"><img src='<?=$latest_skin_path?>/img/fr_img.gif' border=0></td>
    <td width="85%" style="padding-top:4; padding-left:10; border-top-width:1; border-right-width:0; border-bottom-width:1; border-left-width:0; border-top-color:silver; border-right-color:black; border-bottom-color:silver; border-left-color:black; border-style:solid;" height="30" bgcolor="#FFFFFF"><strong><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><font color="#808080"><?=$board[bo_subject]?></font></a></strong></td>
        <td align="center" style="padding-right:12; border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:0; border-top-color:silver; border-right-color:silver; border-bottom-color:silver; border-left-color:black; border-style:solid;" bgcolor="#FFFFFF" height="30"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src='<?=$latest_skin_path?>/img/more.gif' border=0></a></td>
</tr>
        <tr>
          <td height="8"></td>
        </tr>
</table>

<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<div style="width:<?php echo $width; ?>px;">
<?php for($i = 0; $i < count($list); $i++){ ?><div id="<?php echo "{$bo_table}_{$i}"; ?>" style="<?php if($i == 0) echo 'display:block;border:0;'; else echo 'display:none;border:0;'; ?>"><a href="<?php echo $list[$i]['href']; ?>" onfocus="this.blur();"><?php echo make_thumbnail("{$list[$i]['file']['0']['path']}/{$list[$i]['file']['0']['file']}", "{$list[$i]['file']['0']['path']}/{$list[$i]['file']['0']['file']}.thumb", $width, $height, $default); ?></a></div><?php } ?>
</div>
</td>
<td width="12"></td>
<td width="" valign="top" style="padding:3px 0 0 0;">
<table border="0" cellspacing="0" cellpadding="0">
<?php for($i = 0; $i < count($list); $i++){ ?>
<tr><td height="20"><img src="<?php echo $latest_skin_path; ?>/img/i_bullet.gif" align="absmiddle"> <a href="<?php echo $list[$i]['href']; ?>" onmouseover="layer('<?php echo $bo_table; ?>', '<?php echo $i; ?>');" onfocus="this.blur();" style="color:#222222;"><?php echo str_replace('…', '..', $list[$i]['subject']) ?></a></td></tr>
<?php } ?>
</table>
</td>
</tr>
</table>
--------------------------------------------------------
아래는 latest.lib.php 파일입니다.

<?php

function make_thumbnail($exist, $creat, $width, $height, $default = null)
{
global $g4;
if(file_exists($exist) == true && in_array(strtolower(array_pop(explode('.', $exist))), array('gif', 'jpg', 'jpeg', 'png')) == true)
{
if(file_exists($creat) == false)
{
list($img['width'], $img['height'], $img['type']) = getimagesize($exist);
switch($img['type'])
{
case '1' :

$src['image'] = imagecreatefromgif($exist);
$dst['image'] = imagecreate($width, $height);
break;

case '2' :

$src['image'] = imagecreatefromjpeg($exist);
$dst['image'] = imagecreatetruecolor($width, $height);
break;

case '3' :

$src['image'] = imagecreatefrompng($exist);
$dst['image'] = imagecreatetruecolor($width, $height);
break;
}
$dst['color'] = imagecolorallocate($dst['image'], 255, 255, 255);
imagefilledrectangle($dst['image'], 0, 0, $width, $height, $dst['color']);
imagecopyresampled($dst['image'], $src['image'], 0, 0, 0, 0, $width, $height, $img['width'], $img['height']);
switch($img['type'])
{
case '1' :

imagegif($dst['image'], $creat);
break;

case '2' :

imagejpeg($dst['image'], $creat, 100);
break;

case '3' :

imagepng($dst['image'], $creat, 100);
break;
}
imagedestroy($src['image']);
imagedestroy($dst['image']);
}
$return = "<img src=\"{$creat}\">";
}
else
{
$return = $default;
}
return $return;
}

?>

댓글 전체

전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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