파일 첨부 2개 넣어서 2단 배열 그림 뷰 페이지 만드는것좀 도와주실분~~ 정보
파일 첨부 2개 넣어서 2단 배열 그림 뷰 페이지 만드는것좀 도와주실분~~본문
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
$thumb_width = 350; // 메인 썸네일 이미지 가로크기
$thumb_quality = 100; // 메인 썸네일 이미지 퀄리티
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
$rewidth = 70; // 서브 썸네일 이미지 가로크기
$reheight = 52; // 서브 썸네일 이미지 세로크기
$imgfile = array();
$imgfile2 = array();
?>
<div style="height:12px; line-height:1px; font-size:1px;"> </div>
<style type="text/css">
.top { font-weight:bold; font-size:12px; text-align:center; background-color:#95A7DD; border-top:3px solid <?=$board[bo_color]?>; border-bottom:1px solid <?=$board[bo_color]?>; white-space:nowrap; height:36px; color:#FFFFFF; }
.top2 { font-weight:bold; font-size:12px; background-color:#EDF0F9; border-top:3px solid <?=$board[bo_color]?>; border-bottom:1px solid <?=$board[bo_color]?>; white-space:nowrap; height:36px; color:#5E5E5E; padding-left:15px; }
.field { padding:.5em; border-bottom:1px solid #DDDEF4; }
</style>
<!-- 게시글 보기 시작 -->
<table width="<?=$width?>" cellpadding="0" cellspacing="0"><tr><td>
<div style="clear:both; height:30px;">
<div style="float:left; margin-top:6px;">
<img src="<?=$board_skin_path?>/img/icon_date.gif" align=absmiddle border='0'>
<span style="color:#888888;">작성일 : <?=date("y-m-d H:i", strtotime($view[wr_datetime]))?></span>
</div>
<!-- 링크 버튼 -->
<div style="float:right;">
<?
ob_start();
?>
<? if ($copy_href) { echo "<a href=\"$copy_href\"><img src='$board_skin_path/img/btn_copy.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($move_href) { echo "<a href=\"$move_href\"><img src='$board_skin_path/img/btn_move.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($search_href) { echo "<a href=\"$search_href\"><img src='$board_skin_path/img/btn_list_search.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($update_href) { echo "<a href=\"$update_href\"><img src='$board_skin_path/img/btn_modify.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($delete_href) { echo "<a href=\"$delete_href\"><img src='$board_skin_path/img/btn_delete.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($reply_href) { echo "<a href=\"$reply_href\"><img src='$board_skin_path/img/btn_reply.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($write_href) { echo "<a href=\"$write_href\"><img src='$board_skin_path/img/btn_write.gif' border='0' align='absmiddle'></a> "; } ?>
<? echo "<a href=\"$list_href\"><img src='$board_skin_path/img/btn_list.gif' border='0' align='absmiddle'></a> "; ?>
<?
$link_buttons = ob_get_contents();
ob_end_flush();
?>
</div>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" style="height:34px; background-color:#F49A56;color:#505050; font-size:13px; font-weight:bold; word-break:break-all;"> <?=cut_hangul_last(get_text($view[wr_subject]))?></td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width="97%" align="center">
<!--tr>
<td height=30 class="field">
<div style="float:left;">
글쓴이 :
<?=$view[name]?><? if ($is_ip_view) { echo " ($ip)"; } ?>
</div>
<div style="float:right;">
<img src="<?=$board_skin_path?>/img/icon_view.gif" border='0' align=absmiddle> 조회 : <?=number_format($view[wr_hit])?>
<? if ($is_good) { ?> <img src="<?=$board_skin_path?>/img/icon_good.gif" border='0' align=absmiddle> 추천 : <?=number_format($view[wr_good])?><? } ?>
<? if ($is_nogood) { ?> <img src="<?=$board_skin_path?>/img/icon_nogood.gif" border='0' align=absmiddle> 비추천 : <?=number_format($view[wr_nogood])?><? } ?>
</div>
</td>
</tr-->
<tr>
<td height="35" valign="bottom"><img src="/img/sub/bbs/tt01.gif"></td>
</tr>
<tr>
<td height="30" style="padding-left:20px;"><?="[".$view[wr_1]."] ".str_replace("|", " ", $view[wr_2]);?></td>
</tr>
<tr>
<td height="35" valign="bottom"><img src="/img/sub/bbs/tt02.gif"></td>
</tr>
<tr>
<td height="30" style="padding-left:20px;"><?=$view[wr_3]?></td>
</tr>
<tr>
<td height="35" valign="bottom"><img src="/img/sub/bbs/tt010.gif"></td>
</tr>
<tr>
<td height="30" style="padding-left:20px;"><?=$view[wr_10]?></td>
</tr>
<tr>
<td height="35" valign="bottom"><img src="/img/sub/bbs/tt03.gif" ></td>
</tr>
<tr>
<td height="30" style="padding-left:20px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><iframe id="ifr_board" frameborder="0" style="width:600px; border:1px solid #999999; margin:10px 0 10px 0;" src="<?=$board_skin_path?>/ifr_naver_map.php?addr=<?=str_replace("|", "", $view[wr_2])?>" scrolling="no" onLoad="setPage(this);" allowtransparency="true"></iframe></td>
</tr>
</table></td>
</tr>
<?
// 가변 파일
$cnt = 0;
for ($i=0; $i<count($view[file]); $i++) {
if ($view[file][$i][source] && !$view[file][$i][view]) {
$cnt++;
echo "<tr><td height=30 background=\"$board_skin_path/img/view_dot.gif\">";
echo " <img src='{$board_skin_path}/img/icon_file.gif' align=absmiddle border='0'>";
echo "<a href=\"javascript:file_download('{$view[file][$i][href]}', '{$view[file][$i][source]}');\" title='{$view[file][$i][content]}'>";
echo " <span style=\"color:#888;\">{$view[file][$i][source]} ({$view[file][$i][size]})</span>";
echo " <span style=\"color:#ff6600; font-size:11px;\">[{$view[file][$i][download]}]</span>";
echo " <span style=\"color:#d3d3d3; font-size:11px;\">DATE : {$view[file][$i][datetime]}</span>";
echo "</a></td></tr>";
}
}
// 링크
$cnt = 0;
for ($i=1; $i<=$g4[link_count]; $i++) {
if ($view[link][$i]) {
$cnt++;
$link = cut_str($view[link][$i], 70);
echo "<tr><td height=30 background=\"$board_skin_path/img/view_dot.gif\">";
echo " <img src='{$board_skin_path}/img/icon_link.gif' align=absmiddle border='0'>";
echo "<a href='{$view[link_href][$i]}' target=_blank>";
echo " <span style=\"color:#888;\">{$link}</span>";
echo " <span style=\"color:#ff6600; font-size:11px;\">[{$view[link_hit][$i]}]</span>";
echo "</a></td></tr>";
}
}
// 파일 출력
$fInImg = "";
for ($i=0; $i<=count($view[file]); $i++) {
if ($view[file][$i][view]) {
$imgfile[] = $view[file][$i];
${"thumb".$i} = $thumb_path.'/'.$view[file][$i][file];
if (!file_exists(${"thumb".$i})) {
$file = $view[file][$i][path] .'/'. $view[file][$i][file];
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = @getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
continue;
$rate = $thumb_width / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($thumb_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
if ( $size[2] == 1 ) imagegif($dst, ${"thumb".$i}, $thumb_quality);
else if ( $size[2] == 2 ) imagejpeg($dst, ${"thumb".$i}, $thumb_quality);
else if ( $size[2] == 3 ) imagepng($dst, ${"thumb".$i}, $thumb_quality);
chmod(${"thumb".$i}, 0606);
}
}
}
}
if(is_file($thumb_path.'/'.$view[file][0][file])) $fInImg = $thumb_path.'/'.$view[file][0][file];
else $fInImg = "/img/noimages.gif";
$fOutImg = "";
for ($i=0; $i<=count($view[file2]); $i++) {
if ($view[file2][$i][view]) {
$imgfile2[] = $view[file2][$i];
${"thumb2".$i} = $thumb_path.'/'.$view[file2][$i][file];
if (!file_exists(${"thumb2".$i})) {
$file = $view[file2][$i][path] .'/'. $view[file2][$i][file];
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = @getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
continue;
$rate = $thumb_width / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($thumb_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
if ( $size[2] == 1 ) imagegif($dst, ${"thumb2".$i}, $thumb_quality);
else if ( $size[2] == 2 ) imagejpeg($dst, ${"thumb2".$i}, $thumb_quality);
else if ( $size[2] == 3 ) imagepng($dst, ${"thumb2".$i}, $thumb_quality);
chmod(${"thumb2".$i}, 0606);
}
}
}
}
if(is_file($thumb_path.'/'.$view[file2][0][file])) $fOutImg = $thumb_path.'/'.$view[file2][0][file];
else $fOutImg = "/img/noimages.gif";
?>
<tr>
<td height="45"><img src="/img/sub/bbs/tt04.gif"></td>
</tr>
<tr>
<td style="padding-left:20px;">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="350" valign="top"><img src="<?=$fInImg?>" width="350" id="fInImg"></td>
<td width="10"></td>
<td align="center" valign="top" bgcolor="#ffffff" style="padding:7px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="5" colspan="5"></td>
</tr>
<? if( count($view[file]) > 0 ) { ?>
<tr>
<?
for ($i = 0; $i < count( $imgfile ); $i++ ) {
$original_file = $imgfile[$i][path]."/".$imgfile[$i][file];
$main_file = $thumb_path."/".$imgfile[$i][file];
$thumb_file = $imgfile[$i][path]."/thumb_".$imgfile[$i][file];
if ( ! file_exists( $thumb_file ) ) // 썸네일 시작
{
list( $img_width, $img_height, $type ) = @getimagesize( $original_file );
if ( $type == 1 ) $img_sour = imagecreatefromgif( $original_file );
else if ( $type == 2 ) $img_sour = imagecreatefromjpeg( $original_file );
else if ( $type == 3 ) $img_sour = imagecreatefrompng( $original_file );
else return false;
if ( $img_width > $img_height )
{
$width = round( $reheight * $img_width / $img_height );
$height = $reheight;
}
else
{
$width = $rewidth;
$height = round( $rewidth * $img_height / $img_width );
}
if ( $width < $rewidth )
{
$width = round( ( $height + $rewidth - $width ) * $img_width / $img_height );
$height = round( ( $width + $rewidth - $width ) * $img_height / $img_width );
}
else if ($height < $reheight)
{
$height = round( ( $width + $reheight - $height ) * $img_height / $img_width );
$width = round( ( $height + $reheight - $height ) * $img_width / $img_height );
}
$x_last = round( ( $width - $rewidth ) / 2 );
$y_last = round( ( $height - $reheight ) / 2 );
if ( ( $img_width < $rewidth ) || ( $img_height < $reheight ) )
{
$img_last = imagecreatetruecolor( $rewidth, $reheight );
$x_last = round( ( $rewidth - $img_width ) / 2 );
$y_last = round( ( $reheight - $img_height ) / 2 );
imagecopy( $img_last, $img_sour, $x_last, $y_last, 0, 0, $width, $height );
imagedestroy( $img_sour );
$white = imagecolorallocate( $img_last, 255, 255, 255);
imagefill( $img_last, 0, 0, $white );
}
else
{
$img_dest = imagecreatetruecolor( $width, $height );
imagecopyresampled( $img_dest, $img_sour, 0, 0, 0, 0, $width, $height, $img_width, $img_height );
$img_last = imagecreatetruecolor( $rewidth, $reheight );
imagecopy( $img_last, $img_dest, 0, 0, $x_last, $y_last, $width, $height );
imagedestroy( $img_dest );
}
if ( $type == 1 ) imagegif($img_last, $thumb_file, 100);
else if ( $type == 2 ) imagejpeg($img_last, $thumb_file, 100);
else if ( $type == 3 ) imagepng($img_last, $thumb_file, 100);
imagedestroy($img_last);
} // 썸네일 끝
if($i%3 != 0) echo "<td width='7'></td>";
?>
<td bgcolor="#ffffff"><img src="<?=$thumb_file?>" width="70" style="border:1px solid #D9D9D9; cursor:pointer;" onClick="inImgChange('<?=$main_file?>');"></td>
<?
if($i%3 == 2) {
?>
</tr>
<tr><td height="7" colspan="5"></td></tr>
<tr>
<?
}
}
?>
</tr>
<? } ?>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="45"><img src="/img/sub/bbs/tt05.gif"></td>
</tr>
<tr>
<td style="padding-left:20px;">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="350" valign="top"><img src="<?=$fOutImg?>" width="350" id="fOutImg"></td>
<td width="10"></td>
<td align="center" valign="top" bgcolor="#ffffff" style="padding:7px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="5" colspan="5"></td>
</tr>
<tr>
<?
for ($i = 0; $i < count( $imgfile2 ); $i++ ) {
$original_file = $imgfile2[$i][path]."/".$imgfile2[$i][file];
$main_file = $thumb_path."/".$imgfile2[$i][file];
$thumb_file = $imgfile2[$i][path]."/thumb_".$imgfile2[$i][file];
if ( ! file_exists( $thumb_file ) ) // 썸네일 시작
{
list( $img_width, $img_height, $type ) = @getimagesize( $original_file );
if ( $type == 1 ) $img_sour = imagecreatefromgif( $original_file );
else if ( $type == 2 ) $img_sour = imagecreatefromjpeg( $original_file );
else if ( $type == 3 ) $img_sour = imagecreatefrompng( $original_file );
else return false;
if ( $img_width > $img_height )
{
$width = round( $reheight * $img_width / $img_height );
$height = $reheight;
}
else
{
$width = $rewidth;
$height = round( $rewidth * $img_height / $img_width );
}
if ( $width < $rewidth )
{
$width = round( ( $height + $rewidth - $width ) * $img_width / $img_height );
$height = round( ( $width + $rewidth - $width ) * $img_height / $img_width );
}
else if ($height < $reheight)
{
$height = round( ( $width + $reheight - $height ) * $img_height / $img_width );
$width = round( ( $height + $reheight - $height ) * $img_width / $img_height );
}
$x_last = round( ( $width - $rewidth ) / 2 );
$y_last = round( ( $height - $reheight ) / 2 );
if ( ( $img_width < $rewidth ) || ( $img_height < $reheight ) )
{
$img_last = imagecreatetruecolor( $rewidth, $reheight );
$x_last = round( ( $rewidth - $img_width ) / 2 );
$y_last = round( ( $reheight - $img_height ) / 2 );
imagecopy( $img_last, $img_sour, $x_last, $y_last, 0, 0, $width, $height );
imagedestroy( $img_sour );
$white = imagecolorallocate( $img_last, 255, 255, 255);
imagefill( $img_last, 0, 0, $white );
}
else
{
$img_dest = imagecreatetruecolor( $width, $height );
imagecopyresampled( $img_dest, $img_sour, 0, 0, 0, 0, $width, $height, $img_width, $img_height );
$img_last = imagecreatetruecolor( $rewidth, $reheight );
imagecopy( $img_last, $img_dest, 0, 0, $x_last, $y_last, $width, $height );
imagedestroy( $img_dest );
}
if ( $type == 1 ) imagegif($img_last, $thumb_file, 100);
else if ( $type == 2 ) imagejpeg($img_last, $thumb_file, 100);
else if ( $type == 3 ) imagepng($img_last, $thumb_file, 100);
imagedestroy($img_last);
} // 썸네일 끝
if($i%3 != 0) echo "<td width='7'></td>";
?>
<td bgcolor="#F6F6F6"><img src="<?=$thumb_file?>" width="70" style="border:1px solid #D9D9D9; cursor:pointer;" onClick="outImgChange('<?=$main_file?>');"></td>
<?
if($i%3 == 2) {
?>
</tr>
<tr><td height="7" colspan="5"></td></tr>
<tr>
<?
}
}
?>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
>>>>> 첫번째 파일첨부에 들어간 그림들은 배열로 잘나옵니다~~
2번째 파일첨부는 노이미지 뜨네요~~ 도와주세요~~
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
$thumb_width = 350; // 메인 썸네일 이미지 가로크기
$thumb_quality = 100; // 메인 썸네일 이미지 퀄리티
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
$rewidth = 70; // 서브 썸네일 이미지 가로크기
$reheight = 52; // 서브 썸네일 이미지 세로크기
$imgfile = array();
$imgfile2 = array();
?>
<div style="height:12px; line-height:1px; font-size:1px;"> </div>
<style type="text/css">
.top { font-weight:bold; font-size:12px; text-align:center; background-color:#95A7DD; border-top:3px solid <?=$board[bo_color]?>; border-bottom:1px solid <?=$board[bo_color]?>; white-space:nowrap; height:36px; color:#FFFFFF; }
.top2 { font-weight:bold; font-size:12px; background-color:#EDF0F9; border-top:3px solid <?=$board[bo_color]?>; border-bottom:1px solid <?=$board[bo_color]?>; white-space:nowrap; height:36px; color:#5E5E5E; padding-left:15px; }
.field { padding:.5em; border-bottom:1px solid #DDDEF4; }
</style>
<!-- 게시글 보기 시작 -->
<table width="<?=$width?>" cellpadding="0" cellspacing="0"><tr><td>
<div style="clear:both; height:30px;">
<div style="float:left; margin-top:6px;">
<img src="<?=$board_skin_path?>/img/icon_date.gif" align=absmiddle border='0'>
<span style="color:#888888;">작성일 : <?=date("y-m-d H:i", strtotime($view[wr_datetime]))?></span>
</div>
<!-- 링크 버튼 -->
<div style="float:right;">
<?
ob_start();
?>
<? if ($copy_href) { echo "<a href=\"$copy_href\"><img src='$board_skin_path/img/btn_copy.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($move_href) { echo "<a href=\"$move_href\"><img src='$board_skin_path/img/btn_move.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($search_href) { echo "<a href=\"$search_href\"><img src='$board_skin_path/img/btn_list_search.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($update_href) { echo "<a href=\"$update_href\"><img src='$board_skin_path/img/btn_modify.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($delete_href) { echo "<a href=\"$delete_href\"><img src='$board_skin_path/img/btn_delete.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($reply_href) { echo "<a href=\"$reply_href\"><img src='$board_skin_path/img/btn_reply.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($write_href) { echo "<a href=\"$write_href\"><img src='$board_skin_path/img/btn_write.gif' border='0' align='absmiddle'></a> "; } ?>
<? echo "<a href=\"$list_href\"><img src='$board_skin_path/img/btn_list.gif' border='0' align='absmiddle'></a> "; ?>
<?
$link_buttons = ob_get_contents();
ob_end_flush();
?>
</div>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" style="height:34px; background-color:#F49A56;color:#505050; font-size:13px; font-weight:bold; word-break:break-all;"> <?=cut_hangul_last(get_text($view[wr_subject]))?></td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width="97%" align="center">
<!--tr>
<td height=30 class="field">
<div style="float:left;">
글쓴이 :
<?=$view[name]?><? if ($is_ip_view) { echo " ($ip)"; } ?>
</div>
<div style="float:right;">
<img src="<?=$board_skin_path?>/img/icon_view.gif" border='0' align=absmiddle> 조회 : <?=number_format($view[wr_hit])?>
<? if ($is_good) { ?> <img src="<?=$board_skin_path?>/img/icon_good.gif" border='0' align=absmiddle> 추천 : <?=number_format($view[wr_good])?><? } ?>
<? if ($is_nogood) { ?> <img src="<?=$board_skin_path?>/img/icon_nogood.gif" border='0' align=absmiddle> 비추천 : <?=number_format($view[wr_nogood])?><? } ?>
</div>
</td>
</tr-->
<tr>
<td height="35" valign="bottom"><img src="/img/sub/bbs/tt01.gif"></td>
</tr>
<tr>
<td height="30" style="padding-left:20px;"><?="[".$view[wr_1]."] ".str_replace("|", " ", $view[wr_2]);?></td>
</tr>
<tr>
<td height="35" valign="bottom"><img src="/img/sub/bbs/tt02.gif"></td>
</tr>
<tr>
<td height="30" style="padding-left:20px;"><?=$view[wr_3]?></td>
</tr>
<tr>
<td height="35" valign="bottom"><img src="/img/sub/bbs/tt010.gif"></td>
</tr>
<tr>
<td height="30" style="padding-left:20px;"><?=$view[wr_10]?></td>
</tr>
<tr>
<td height="35" valign="bottom"><img src="/img/sub/bbs/tt03.gif" ></td>
</tr>
<tr>
<td height="30" style="padding-left:20px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><iframe id="ifr_board" frameborder="0" style="width:600px; border:1px solid #999999; margin:10px 0 10px 0;" src="<?=$board_skin_path?>/ifr_naver_map.php?addr=<?=str_replace("|", "", $view[wr_2])?>" scrolling="no" onLoad="setPage(this);" allowtransparency="true"></iframe></td>
</tr>
</table></td>
</tr>
<?
// 가변 파일
$cnt = 0;
for ($i=0; $i<count($view[file]); $i++) {
if ($view[file][$i][source] && !$view[file][$i][view]) {
$cnt++;
echo "<tr><td height=30 background=\"$board_skin_path/img/view_dot.gif\">";
echo " <img src='{$board_skin_path}/img/icon_file.gif' align=absmiddle border='0'>";
echo "<a href=\"javascript:file_download('{$view[file][$i][href]}', '{$view[file][$i][source]}');\" title='{$view[file][$i][content]}'>";
echo " <span style=\"color:#888;\">{$view[file][$i][source]} ({$view[file][$i][size]})</span>";
echo " <span style=\"color:#ff6600; font-size:11px;\">[{$view[file][$i][download]}]</span>";
echo " <span style=\"color:#d3d3d3; font-size:11px;\">DATE : {$view[file][$i][datetime]}</span>";
echo "</a></td></tr>";
}
}
// 링크
$cnt = 0;
for ($i=1; $i<=$g4[link_count]; $i++) {
if ($view[link][$i]) {
$cnt++;
$link = cut_str($view[link][$i], 70);
echo "<tr><td height=30 background=\"$board_skin_path/img/view_dot.gif\">";
echo " <img src='{$board_skin_path}/img/icon_link.gif' align=absmiddle border='0'>";
echo "<a href='{$view[link_href][$i]}' target=_blank>";
echo " <span style=\"color:#888;\">{$link}</span>";
echo " <span style=\"color:#ff6600; font-size:11px;\">[{$view[link_hit][$i]}]</span>";
echo "</a></td></tr>";
}
}
// 파일 출력
$fInImg = "";
for ($i=0; $i<=count($view[file]); $i++) {
if ($view[file][$i][view]) {
$imgfile[] = $view[file][$i];
${"thumb".$i} = $thumb_path.'/'.$view[file][$i][file];
if (!file_exists(${"thumb".$i})) {
$file = $view[file][$i][path] .'/'. $view[file][$i][file];
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = @getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
continue;
$rate = $thumb_width / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($thumb_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
if ( $size[2] == 1 ) imagegif($dst, ${"thumb".$i}, $thumb_quality);
else if ( $size[2] == 2 ) imagejpeg($dst, ${"thumb".$i}, $thumb_quality);
else if ( $size[2] == 3 ) imagepng($dst, ${"thumb".$i}, $thumb_quality);
chmod(${"thumb".$i}, 0606);
}
}
}
}
if(is_file($thumb_path.'/'.$view[file][0][file])) $fInImg = $thumb_path.'/'.$view[file][0][file];
else $fInImg = "/img/noimages.gif";
$fOutImg = "";
for ($i=0; $i<=count($view[file2]); $i++) {
if ($view[file2][$i][view]) {
$imgfile2[] = $view[file2][$i];
${"thumb2".$i} = $thumb_path.'/'.$view[file2][$i][file];
if (!file_exists(${"thumb2".$i})) {
$file = $view[file2][$i][path] .'/'. $view[file2][$i][file];
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = @getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
continue;
$rate = $thumb_width / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($thumb_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
if ( $size[2] == 1 ) imagegif($dst, ${"thumb2".$i}, $thumb_quality);
else if ( $size[2] == 2 ) imagejpeg($dst, ${"thumb2".$i}, $thumb_quality);
else if ( $size[2] == 3 ) imagepng($dst, ${"thumb2".$i}, $thumb_quality);
chmod(${"thumb2".$i}, 0606);
}
}
}
}
if(is_file($thumb_path.'/'.$view[file2][0][file])) $fOutImg = $thumb_path.'/'.$view[file2][0][file];
else $fOutImg = "/img/noimages.gif";
?>
<tr>
<td height="45"><img src="/img/sub/bbs/tt04.gif"></td>
</tr>
<tr>
<td style="padding-left:20px;">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="350" valign="top"><img src="<?=$fInImg?>" width="350" id="fInImg"></td>
<td width="10"></td>
<td align="center" valign="top" bgcolor="#ffffff" style="padding:7px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="5" colspan="5"></td>
</tr>
<? if( count($view[file]) > 0 ) { ?>
<tr>
<?
for ($i = 0; $i < count( $imgfile ); $i++ ) {
$original_file = $imgfile[$i][path]."/".$imgfile[$i][file];
$main_file = $thumb_path."/".$imgfile[$i][file];
$thumb_file = $imgfile[$i][path]."/thumb_".$imgfile[$i][file];
if ( ! file_exists( $thumb_file ) ) // 썸네일 시작
{
list( $img_width, $img_height, $type ) = @getimagesize( $original_file );
if ( $type == 1 ) $img_sour = imagecreatefromgif( $original_file );
else if ( $type == 2 ) $img_sour = imagecreatefromjpeg( $original_file );
else if ( $type == 3 ) $img_sour = imagecreatefrompng( $original_file );
else return false;
if ( $img_width > $img_height )
{
$width = round( $reheight * $img_width / $img_height );
$height = $reheight;
}
else
{
$width = $rewidth;
$height = round( $rewidth * $img_height / $img_width );
}
if ( $width < $rewidth )
{
$width = round( ( $height + $rewidth - $width ) * $img_width / $img_height );
$height = round( ( $width + $rewidth - $width ) * $img_height / $img_width );
}
else if ($height < $reheight)
{
$height = round( ( $width + $reheight - $height ) * $img_height / $img_width );
$width = round( ( $height + $reheight - $height ) * $img_width / $img_height );
}
$x_last = round( ( $width - $rewidth ) / 2 );
$y_last = round( ( $height - $reheight ) / 2 );
if ( ( $img_width < $rewidth ) || ( $img_height < $reheight ) )
{
$img_last = imagecreatetruecolor( $rewidth, $reheight );
$x_last = round( ( $rewidth - $img_width ) / 2 );
$y_last = round( ( $reheight - $img_height ) / 2 );
imagecopy( $img_last, $img_sour, $x_last, $y_last, 0, 0, $width, $height );
imagedestroy( $img_sour );
$white = imagecolorallocate( $img_last, 255, 255, 255);
imagefill( $img_last, 0, 0, $white );
}
else
{
$img_dest = imagecreatetruecolor( $width, $height );
imagecopyresampled( $img_dest, $img_sour, 0, 0, 0, 0, $width, $height, $img_width, $img_height );
$img_last = imagecreatetruecolor( $rewidth, $reheight );
imagecopy( $img_last, $img_dest, 0, 0, $x_last, $y_last, $width, $height );
imagedestroy( $img_dest );
}
if ( $type == 1 ) imagegif($img_last, $thumb_file, 100);
else if ( $type == 2 ) imagejpeg($img_last, $thumb_file, 100);
else if ( $type == 3 ) imagepng($img_last, $thumb_file, 100);
imagedestroy($img_last);
} // 썸네일 끝
if($i%3 != 0) echo "<td width='7'></td>";
?>
<td bgcolor="#ffffff"><img src="<?=$thumb_file?>" width="70" style="border:1px solid #D9D9D9; cursor:pointer;" onClick="inImgChange('<?=$main_file?>');"></td>
<?
if($i%3 == 2) {
?>
</tr>
<tr><td height="7" colspan="5"></td></tr>
<tr>
<?
}
}
?>
</tr>
<? } ?>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="45"><img src="/img/sub/bbs/tt05.gif"></td>
</tr>
<tr>
<td style="padding-left:20px;">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="350" valign="top"><img src="<?=$fOutImg?>" width="350" id="fOutImg"></td>
<td width="10"></td>
<td align="center" valign="top" bgcolor="#ffffff" style="padding:7px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="5" colspan="5"></td>
</tr>
<tr>
<?
for ($i = 0; $i < count( $imgfile2 ); $i++ ) {
$original_file = $imgfile2[$i][path]."/".$imgfile2[$i][file];
$main_file = $thumb_path."/".$imgfile2[$i][file];
$thumb_file = $imgfile2[$i][path]."/thumb_".$imgfile2[$i][file];
if ( ! file_exists( $thumb_file ) ) // 썸네일 시작
{
list( $img_width, $img_height, $type ) = @getimagesize( $original_file );
if ( $type == 1 ) $img_sour = imagecreatefromgif( $original_file );
else if ( $type == 2 ) $img_sour = imagecreatefromjpeg( $original_file );
else if ( $type == 3 ) $img_sour = imagecreatefrompng( $original_file );
else return false;
if ( $img_width > $img_height )
{
$width = round( $reheight * $img_width / $img_height );
$height = $reheight;
}
else
{
$width = $rewidth;
$height = round( $rewidth * $img_height / $img_width );
}
if ( $width < $rewidth )
{
$width = round( ( $height + $rewidth - $width ) * $img_width / $img_height );
$height = round( ( $width + $rewidth - $width ) * $img_height / $img_width );
}
else if ($height < $reheight)
{
$height = round( ( $width + $reheight - $height ) * $img_height / $img_width );
$width = round( ( $height + $reheight - $height ) * $img_width / $img_height );
}
$x_last = round( ( $width - $rewidth ) / 2 );
$y_last = round( ( $height - $reheight ) / 2 );
if ( ( $img_width < $rewidth ) || ( $img_height < $reheight ) )
{
$img_last = imagecreatetruecolor( $rewidth, $reheight );
$x_last = round( ( $rewidth - $img_width ) / 2 );
$y_last = round( ( $reheight - $img_height ) / 2 );
imagecopy( $img_last, $img_sour, $x_last, $y_last, 0, 0, $width, $height );
imagedestroy( $img_sour );
$white = imagecolorallocate( $img_last, 255, 255, 255);
imagefill( $img_last, 0, 0, $white );
}
else
{
$img_dest = imagecreatetruecolor( $width, $height );
imagecopyresampled( $img_dest, $img_sour, 0, 0, 0, 0, $width, $height, $img_width, $img_height );
$img_last = imagecreatetruecolor( $rewidth, $reheight );
imagecopy( $img_last, $img_dest, 0, 0, $x_last, $y_last, $width, $height );
imagedestroy( $img_dest );
}
if ( $type == 1 ) imagegif($img_last, $thumb_file, 100);
else if ( $type == 2 ) imagejpeg($img_last, $thumb_file, 100);
else if ( $type == 3 ) imagepng($img_last, $thumb_file, 100);
imagedestroy($img_last);
} // 썸네일 끝
if($i%3 != 0) echo "<td width='7'></td>";
?>
<td bgcolor="#F6F6F6"><img src="<?=$thumb_file?>" width="70" style="border:1px solid #D9D9D9; cursor:pointer;" onClick="outImgChange('<?=$main_file?>');"></td>
<?
if($i%3 == 2) {
?>
</tr>
<tr><td height="7" colspan="5"></td></tr>
<tr>
<?
}
}
?>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
>>>>> 첫번째 파일첨부에 들어간 그림들은 배열로 잘나옵니다~~
2번째 파일첨부는 노이미지 뜨네요~~ 도와주세요~~
댓글 전체
감사합니다~~