<?
$thumb_width = "145"; //썸네일 가로길이
$thumb_height = "95"; //썸네일 세로길이
$quality= 90; //썸네일 퀄리티
$filter[type] = 99;
$filter[arg1] = 100;
$filter[arg2] = 1;
$filter[arg3] = 2;

// 게시판
$tmp_table = "portfolio";

// colspan
$colspan = "3";

// 가로 이미지 수
$mod = "1";

$IMG_WIDTH = "20%";

// 제목길이
$subject_len = "30";

// 출력갯수
$rows = "1";
?>


<style type="text/css">
/* new */

.new {clear:both; width:100%; text-align:left;}

.new dd {margin:0; padding:0;}

.new .new_list {clear:both;}
.new .new_list dl dt {clear:both; height:21px;}
.new .new_list dl dd {clear:both; height:110px; margin-bottom:25px; padding:10px 0px 0px 0px; background-color:#ffffff; border:0px solid #dddddd;}

.new .new_list dl dt .tit {float:left;}
.new .new_list dl dt .sli {padding-right:5px; float:right;}

.new .new_list dl .num {padding:2px 5px 0 0; float:left;}
.new .new_list dl .btn {float:left;}
.new .new_list dl .side_num1 {font-weight:bold; line-height:14px; font-size:11px; color:#848689; }
.new .new_list dl .side_num2 {padding:0 1px 0 1px; line-height:14px; font-size:11px; color:#b3b7bc; }
.new .new_list dl .side_num3 {font-weight:bold; line-height:14px; font-size:11px; color:#b3b7bc; }

.new .new_list dl .title {font-weight:bold; line-height:14px; font-size:12px; color:#505050; }
.new .new_list dl .text {line-height:16px; font-size:12px; color:#444444; letter-spacing:-1px;}
#premium_photo{width:145px;height:95px;position:absolute;z-index:10;}
#premium_photo img{border:#dddddd 1px solid;}
#premium_subject{margin-top:72px; margin-left:1px; position:absolute; z-index:11; width:145px; height:22px; background-color:#000000;filter:Alpha(Opacity=70);opacity:0.7; text-align:center;color:#ffffff; font-size:11px; letter-spacing:-1px; padding-top:3px;}
</style>

<script type="text/javascript" src="<?=$g4[path]?>/js/tab.js"></script>

<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
    <td>

		<!-- new start //-->
		<div class="new">

			<div class="new_list">

				<dl>

					<dt><div class="tit"><span class="title">새로운 사진</span></div><div class="sli"><div class="num"><span id="side_num1" class="side_num1">1</span><span class="side_num2">/</span><span class="side_num3">3</span></div><div class="btn"><a href="javascript:sidelistTab('prev', '1');" onfocus="this.blur();"><img src="/img/btn_prev_v2.gif" border="0"></a><a href="javascript:sidelistTab('next', '1');" onfocus="this.blur();"><img src="/img/btn_next_v2.gif" border="0"></a></div></div></dt>

					<dd>

						<div id="side_list1_tab1" style="display:inline;">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<?
						// 초기화
						$AddNoticeCnt = "";
						$AddGalleryNotice = "";
						$AddGallery = "";
						$j = "0";

						$sql = " select wr_id, wr_subject, wr_content from {$g4[write_prefix]}{$tmp_table} where wr_is_comment = '0' order by wr_id desc limit 0, $rows ";
						$result = sql_query($sql);
						for ($i=0; $data=sql_fetch_array($result); $i++) {


							// 제목
							$subject = conv_subject($data['wr_subject'], $subject_len, '');

							// href
							$href = $g4['bbs_path']."/board.php?bo_table=".$tmp_table."&wr_id=".$data['wr_id'];

							// 이미지 체크
							$sql = " select bf_file from $g4[board_file_table] where bo_table = '{$tmp_table}' and wr_id = '{$data['wr_id']}' and bf_type in (1,2,3) ";
							$listFile = sql_fetch($sql);

							if($listFile['bf_file']) { // 첨부파일이 있으면
								$src = "{$g4[path]}/data/file/{$tmp_table}/{$listFile['bf_file']}";
								$thumb = thumbnail($src, $thumb_width, $thumb_height, 0, 1, $quality, 0, "",  $filter, $noimg);
							}  else { // 치에디터 파일 추출
								$edit_img = $data['wr_content'];
								if (eregi("data/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)", $edit_img, $tmp)) {
									$file = $g4[path].'/' . $tmp[0]; // 파일명
									$thumb = thumbnail($file, $thumb_width, $thumb_height, 0, 1, $quality, 0, "",  $filter, $noimg);
								}
							}


						//이미지
							if (file_exists($thumb))
								$thumfile = "<a href='".$href."' onfocus='this.blur();'><img src='{$thumb}' border='0' width='{$thumb_width}px' height='{$thumb_height}px' \></a>";
								else
								//이미지가 없으면
								$thumfile="<a href='".$href."' onfocus='this.blur();'><img src='/img/no_image.gif' width='{$thumb_width}px' height='{$thumb_height}px'></a>";
								//이미지가 아니네
								if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file)){
								$thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$thumb_width', '$thumb_height', 'transparent'));</script>"; 
								}   
							

							$j++;

							if ($j && $j%$mod == '1') {

								$AddGallery .= "</tr>\n<tr><td colspan='".$mod."' height='1'></td></tr>\n<tr>\n";

							}

							$AddGallery .= "<td width='".$IMG_WIDTH."' style='padding:0 10px 0 10px;' align='center' valign='top'>";
							$AddGallery .= "<table width='".$thumb_width."' border='0' cellspacing='0' cellpadding='0' style='margin-bottom:15px;'>";
							$AddGallery .= "<tr><td align='center' valign='top'>";
							$AddGallery .= "<div id='premium_photo'>".$thumfile."</div>";
							$AddGallery .= "<div id='premium_subject'>".$subject."</div>";
							$AddGallery .= "</td></tr>";
							$AddGallery .= "</table>";
							$AddGallery .= "</td>\n";

						}

						// 나머지 셀을 채운다.
						$k = $j;
						$cnt = $k%$mod;
						if ($cnt) {

							for ($k=$cnt; $k<$mod; $k++) {

								$AddGallery .= "<td width='".$IMG_WIDTH."'></td>\n";

							}

						}
						?>
						<tr><?=$AddGallery?></tr>
						<? if (!$i) { echo "<tr><td colspan='".$mod."' height='100' align='center'><span class='text'>등록된 컨텐츠가 없습니다.</span></td></tr>"; } ?>
						</table>
						</div>

						<div id="side_list1_tab2" style="display:none;">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<?
						// 초기화
						$AddNoticeCnt = "";
						$AddGalleryNotice = "";
						$AddGallery = "";
						$j = "0";

						$sql = " select wr_id, wr_subject, wr_content from {$g4[write_prefix]}{$tmp_table} where wr_is_comment = '0' order by wr_id desc limit $rows, $rows ";
						$result = sql_query($sql);
						for ($i=0; $data=sql_fetch_array($result); $i++) {


							// 제목
							$subject = conv_subject($data['wr_subject'], $subject_len, '');

							// href
							$href = $g4['bbs_path']."/board.php?bo_table=".$tmp_table."&wr_id=".$data['wr_id'];

							// 이미지 체크
							$sql = " select bf_file from $g4[board_file_table] where bo_table = '{$tmp_table}' and wr_id = '{$data['wr_id']}' and bf_type in (1,2,3) ";
							$listFile = sql_fetch($sql);
							
							if($listFile['bf_file']) { // 첨부파일이 있으면
								$src = "{$g4[path]}/data/file/{$tmp_table}/{$listFile['bf_file']}";
								$thumb = thumbnail($src, $thumb_width, $thumb_height, 0, 1, $quality, 0, "",  $filter, $noimg);
							}  else { // 치에디터 파일 추출
								$edit_img = $data['wr_content'];
								if (eregi("data/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)", $edit_img, $tmp)) {
									$file = $g4[path].'/' . $tmp[0]; // 파일명
									$thumb = thumbnail($file, $thumb_width, $thumb_height, 0, 1, $quality, 0, "",  $filter, $noimg);
								}
							}


						//이미지
							if (file_exists($thumb))
								$thumfile = "<a href='".$href."' onfocus='this.blur();'><img src='{$thumb}' border='0' width='{$thumb_width}px' height='{$thumb_height}px' \></a>";
								else
								//이미지가 없으면
								$thumfile="<a href='".$href."' onfocus='this.blur();'><img src='/img/no_image.gif' width='{$thumb_width}px' height='{$thumb_height}px'></a>";
								//이미지가 아니네
								if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file)){
								$thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$thumb_width', '$thumb_height', 'transparent'));</script>"; 
								}   

							$j++;

							if ($j && $j%$mod == '1') {

								$AddGallery .= "</tr>\n<tr><td colspan='".$mod."' height='1'></td></tr>\n<tr>\n";

							}

							$AddGallery .= "<td width='".$IMG_WIDTH."' style='padding:0 10px 0 10px;' align='center' valign='top'>";
							$AddGallery .= "<table width='".$thumb_width."' border='0' cellspacing='0' cellpadding='0' style='margin-bottom:15px;'>";
							$AddGallery .= "<tr><td align='center' valign='top'>";
							$AddGallery .= "<div id='premium_photo'>".$thumfile."</div>";
							$AddGallery .= "<div id='premium_subject'>".$subject."</div>";
							$AddGallery .= "</td></tr>";
							$AddGallery .= "</table>";
							$AddGallery .= "</td>\n";

						}

						// 나머지 셀을 채운다.
						$k = $j;
						$cnt = $k%$mod;
						if ($cnt) {

							for ($k=$cnt; $k<$mod; $k++) {

								$AddGallery .= "<td width='".$IMG_WIDTH."'></td>\n";

							}

						}
						?>
						<tr><?=$AddGallery?></tr>
						<? if (!$i) { echo "<tr><td colspan='".$mod."' height='100' align='center'><span class='text'>등록된 컨텐츠가 없습니다.</span></td></tr>"; } ?>
						</table>
						</div>

						<div id="side_list1_tab3" style="display:none;">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<?
						// 초기화
						$AddNoticeCnt = "";
						$AddGalleryNotice = "";
						$AddGallery = "";
						$j = "0";

						$sql = " select wr_id, wr_subject, wr_content from {$g4[write_prefix]}{$tmp_table} where wr_is_comment = '0' order by wr_id desc limit ".(int)($rows * 2).", $rows ";
						$result = sql_query($sql);
						for ($i=0; $data=sql_fetch_array($result); $i++) {

							// 제목
							$subject = conv_subject($data['wr_subject'], $subject_len, '');

							// href
							$href = $g4['bbs_path']."/board.php?bo_table=".$tmp_table."&wr_id=".$data['wr_id'];

							// 이미지 체크
							$sql = " select bf_file from $g4[board_file_table] where bo_table = '{$tmp_table}' and wr_id = '{$data['wr_id']}' and bf_type in (1,2,3) ";
							$listFile = sql_fetch($sql);
							
							if($listFile['bf_file']) { // 첨부파일이 있으면
								$src = "{$g4[path]}/data/file/{$tmp_table}/{$listFile['bf_file']}";
								$thumb = thumbnail($src, $thumb_width, $thumb_height, 0, 1, $quality, 0, "",  $filter, $noimg);
							}  else { // 치에디터 파일 추출
								$edit_img = $data['wr_content'];
								if (eregi("data/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)", $edit_img, $tmp)) {
									$file = $g4[path].'/' . $tmp[0]; // 파일명
									$thumb = thumbnail($file, $thumb_width, $thumb_height, 0, 1, $quality, 0, "",  $filter, $noimg);
								}
							}


						//이미지
							if (file_exists($thumb))
								$thumfile = "<a href='".$href."' onfocus='this.blur();'><img src='{$thumb}' border='0' width='{$thumb_width}px' height='{$thumb_height}px' \></a>";
								else
								//이미지가 없으면
								$thumfile="<a href='".$href."' onfocus='this.blur();'><img src='/img/no_image.gif' width='{$thumb_width}px' height='{$thumb_height}px'></a>";
								//이미지가 아니네
								if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file)){
								$thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$thumb_width', '$thumb_height', 'transparent'));</script>"; 
								}   

							$j++;

							if ($j && $j%$mod == '1') {

								$AddGallery .= "</tr>\n<tr><td colspan='".$mod."' height='1'></td></tr>\n<tr>\n";

							}

							$AddGallery .= "<td width='".$IMG_WIDTH."' style='padding:0 10px 0 10px;' align='center' valign='top'>";
							$AddGallery .= "<table width='".$thumb_width."' border='0' cellspacing='0' cellpadding='0' style='margin-bottom:15px;'>";
							$AddGallery .= "<tr><td align='center' valign='top'>";
							$AddGallery .= "<div id='premium_photo'>".$thumfile."</div>";
							$AddGallery .= "<div id='premium_subject'>".$subject."</div>";
							$AddGallery .= "</td></tr>";
							$AddGallery .= "</table>";
							$AddGallery .= "</td>\n";

						}

						// 나머지 셀을 채운다.
						$k = $j;
						$cnt = $k%$mod;
						if ($cnt) {

							for ($k=$cnt; $k<$mod; $k++) {

								$AddGallery .= "<td width='".$IMG_WIDTH."'></td>\n";

							}

						}
						?>
						<tr><?=$AddGallery?></tr>
						<? if (!$i) { echo "<tr><td colspan='".$mod."' height='100' align='center'><span class='text'>등록된 컨텐츠가 없습니다.</span></td></tr>"; } ?>
						</table>
						</div>

					</dd>

				</dl>

			</div>

		</div>
		<!-- new end //-->

    <td>
</tr>
</table>
