왕초보 질문좀 드립니다.
본문
왕초보 질문좀 드립니다.
메인화면 썸네일 제목 앞에 블릿이미지를 하나 불로오고 싶은데요 고수님들 답변좀 부탁합니다.
아래 이미지에서 빨간색 표시부분이에요 ^^
답변 12
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$cols = 4; // 이미지 가로갯수 // 이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$imgwidth=200; //표시할 이미지의 가로사이즈
$imgheight=120; //표시할 이미지의 세로사이즈
$img_quality = 100;
$image_h = 0; // 이미지 상하 간격
$col_width = (int)(100 / $cols);
$data_path = $g4[path]."/data/file/$bo_table";
?>
<table width="100%" style="border:1px solid e1e1e1;" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="white">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" width="80" height="25" bgcolor="white"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"target="_self">
<img src="<?=$g4['path']?>/img/btn_more.gif" border="0" title="더보기"></a></td>
<td height="35" align="left"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>" target="_self"><b style="font-size:13px; color:black;">
<?=$board[bo_subject]?></b></a></td>
<td width="30" height="35" align="center" valign="middle"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"target="_self">
<img src="<?=$latest_skin_path?>/img/btn_more.gif" alt="전체보기" border="0" title="전체보기" /></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="0"><!--여백--></td>
</tr>
<tr>
<td align="center" valign="top">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<? for ($i=0; $i<count($list); $i++) {
if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
?>
<td width="<?=$col_width?>%" align="center" valign="top" style="padding-top:0px;">
<?
$image = $list[$i][file][0][file]; //원본
$thumb = $data_path. "/".$image; //썸네일이 없을경우 원본출력
if (preg_match("@<embed.*src=\"//www.youtube.com/v/([^&]+)&?@",$list[$i][wr_content])) {
preg_match("/<embed.*?src=[\"']\/\/www\.youtube\.com\/v\/([^?]+)\?(.*?)['\"]/", $list[$i][wr_content], $matches);
$v = $matches[1];
$thumb_file="<img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' width='{$imgwidth}' height='{$imgheight}' align='absmiddle' border='0' style='margin:10px;'>";
}elseif (file_exists($thumb)) {
$thumb_file = "<img src='".$thumb."' width='{$imgwidth}' height='{$imgheight}' align='absmiddle' border='0' style='margin:10px;'>";
}else{
$thumb_file = "<img src='".$g4[path]."/img/noimage.png' width='{$imgwidth}' height='{$imgheight}' align='absmiddle' border='0' style='margin:10px;'>";
}
echo $list[$i][icon_reply] . " ";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
echo "<tr><td valign='top' align='center'><a href='{$list[$i]['href']}'target='_self'>".$thumb_file."</a></td></tr>";
echo "<tr><td valign='top' align='center' height='30'><a href='{$list[$i]['href']}'target='_self'><span style='font-size:8.7pt; color:464646;'>
{$list[$i]['subject']}</b></span></a></td></tr>";echo "</table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%></td>";
}
?>
<? if (count($list) == 0) { echo "<td align=center>게시물이 없습니다.</td>"; } ?>
</tr>
</table>
</td>
</tr>
</table>
헌이님 감사합니다~
정말 실력이 제일 좋은신듣^^
앞으로 조언좀 많이해주세요 ㅎㅎ