뷰페이지에서 도대체 어디에 코드를 넣어야 노이미지가 출력 될까요.
<table id=image_content cellpadding=0 cellspacing=0 border=0>
<tr>
<?
// 파일 출력
for ($i = 0; $i < count( $file ); $i++ )
{
$original_file = $file[$i][path]."/".$file[$i][file];
$thumb_file = $file[$i][path]."/thumb_".$file[$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);
} // 썸네일 끝
?>
<td style='padding:5px;' width=<?=$td_width?> height=<?=$td_height?> align=center valign=bottom onmouseover='image_over ( <?=$i?> )' onmouseout='image_out( <?=$i?> )'>
<div style='clear:both;'>
<img src='<?=$thumb_file?>' id=thumb_image align=absmiddle style='border:3px solid #ffffff;'>
</div>
</td>
<script language='javascript'>
array_image[<?=$i?>] = "<?=$original_file?>";
</script>
<?
}
?>
<table id=image_content cellpadding=0 cellspacing=0 border=0>
<tr>
<?
// 파일 출력
for ($i = 0; $i < count( $file ); $i++ )
{
$original_file = $file[$i][path]."/".$file[$i][file];
$thumb_file = $file[$i][path]."/thumb_".$file[$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);
} // 썸네일 끝
?>
<td style='padding:5px;' width=<?=$td_width?> height=<?=$td_height?> align=center valign=bottom onmouseover='image_over ( <?=$i?> )' onmouseout='image_out( <?=$i?> )'>
<div style='clear:both;'>
<img src='<?=$thumb_file?>' id=thumb_image align=absmiddle style='border:3px solid #ffffff;'>
</div>
</td>
<script language='javascript'>
array_image[<?=$i?>] = "<?=$original_file?>";
</script>
<?
}
?>
댓글 2개
게시글 목록
| 번호 | 제목 |
|---|---|
| 284348 | |
| 284336 | |
| 284333 | |
| 284332 | |
| 284320 | |
| 284318 | |
| 284316 | |
| 284313 | |
| 284307 | |
| 284306 | |
| 284303 | |
| 284298 | |
| 284296 | |
| 284290 | |
| 284286 | |
| 284280 | |
| 284277 | |
| 284272 | |
| 284261 | |
| 284259 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기