한번 더 질문 드려요.. > 그누4 질문답변

그누4 질문답변

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

한번 더 질문 드려요.. 정보

한번 더 질문 드려요..

본문

안녕하세요.
종종 그누보드를 들리는 유저인데요..

현재 제가 갤러리 스킨을 시하님께서 배포하신걸 사용중이구요.
최신글 스킨을 150*120에 고정하여 쓰고 있습니다.

그런데 첫번째 그림이 가로일 경우에는 큰 문제가 없는데..
세로일 경우에는.. 아래로 찌그러져 보여서요..

이미지 파일을 읽어와서 가로로 길때는 가로 길이를 150으로 해 주고..
세로가 길 때는 세로 길이를 150으로 해주고 싶습니다.

이럴 땐 어떻게 해야 할까요?

가지고 있는 모든 포인트를 걸어봅니다..^^;;;
아래 갤러리 최신글 소스입니다.


-----------------------------------


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$cols  =5; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$imgwidth=140; //표시할 이미지의 가로사이즈
$imgheight=105; //표시할 이미지의 세로사이즈
$image_h  = 0; // 이미지 상하 간격

$col_width = (int)(99 / $cols);

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
?>
<style type="text/css">
<!--
.data  { font-size:8pt; color:#999999; }
-->
</style>


<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">

<!-- 최신글 제목 -->
<tr>
<td style="padding-left:10px">
<table width=100% cellpadding="0" cellspacing="0">
<tr>
<td align="left"><img src="<?=$latest_skin_path?>/img/photo_title.gif"></td>
<td align="right"><a href="../bbs/board.php?bo_table=por_01" target="_self"><img src="../skin/latest/notice/img/more.gif" border="0"></a></td>
</tr>
</table>
</td>
</tr>

<tr><td height="10"></td></tr>
<tr>
<td align="center">
<table width="100%" border="0" 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'>

<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];

  if ( file_exists($thumb) )
$img = $thumb;
 
    $style = "font-size:9pt; color:#636363;";
    if ($list[$i][icon_new])
    $style = "style='font-size:9pt;' ";
$subject = "<span $style>".cut_str($list[$i][subject],25)."</span>"; //제목 글자수 자르기

$bg = "";  //새글?
    if ($list[$i][icon_new])
        $bg="la_top_2.gif";
    else
        $bg="la_top_1.gif";

    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']}'><img src='$img' width='{$imgwidth}' height='{$imgheight}' align='absmiddle' style='width:{$imgwidth}px;height:{$imgheight}px;border:1px solid #CCCCCC; padding:3px'></a></td></tr>";
echo " <tr><td align='center' height='21'><a href='{$list[$i]['href']}'>{$subject}</a></td></tr></table>";
?>
</td>
<? } ?>

<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
    echo "<td width=$col_width%>&nbsp;</td>";
}
?>

  <? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
  </tr>
</table>
  • 복사

댓글 전체

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$cols  =5; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$max=150; //  //표시할 이미지의 긴쪽사이즈
$image_h  = 0; // 이미지 상하 간격

$col_width = (int)(99 / $cols);

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
?>
<style type="text/css">
<!--
.data  { font-size:8pt; color:#999999; }
-->
</style>


<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">

<!-- 최신글 제목 -->
<tr>
<td style="padding-left:10px">
<table width=100% cellpadding="0" cellspacing="0">
<tr>
<td align="left"><img src="<?=$latest_skin_path?>/img/photo_title.gif"></td>
<td align="right"><a href="../bbs/board.php?bo_table=por_01" target="_self"><img src="../skin/latest/notice/img/more.gif" border="0"></a></td>
</tr>
</table>
</td>
</tr>

<tr><td height="10"></td></tr>
<tr>
<td align="center">
<table width="100%" border="0" 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'>

<?
$thumb = $thumb_path. "/". $list[$i][wr_id];

if ( file_exists($thumb) ) {
$info=getimagesize($thumb);
$W = $info[0];
$H = $info[1];

if ( $W > $H ) { //가로형일 경우.
$imgwidth = $max ;
$imgheight = ceil( $H * ( $max / $W ) );
}
else if ( $W < $H ) { //세로형일 경우.
$imgheight = $max ;
$imgwidth = ceil( $W * ( $max / $H ) );
}
else if ( $W == $H ) { //정사각형일 경우.
$imgwidth = ceil($max);
$imgheight = ceil($max);
}
$img = $thumb;

}else{ //썸네일이 없을경우 원본으로 출력

$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image;

$info=getimagesize($img);
$W = $info[0];
$H = $info[1];

if ( $W > $H ) { //가로형일 경우.
$imgwidth = $max ;
$imgheight = ceil( $H * ( $max / $W ) );
}
else if ( $W < $H ) { //세로형일 경우.
$imgheight = $max ;
$imgwidth = ceil( $W * ( $max / $H ) );
}
else if ( $W == $H ) { //정사각형일 경우.
$imgwidth = ceil($max);
$imgheight = ceil($max);
}
}

 
    $style = "font-size:9pt; color:#636363;";
    if ($list[$i][icon_new])
    $style = "style='font-size:9pt;' ";
$subject = "<span $style>".cut_str($list[$i][subject],25)."</span>"; //제목 글자수 자르기

$bg = "";  //새글?
    if ($list[$i][icon_new])
        $bg="la_top_2.gif";
    else
        $bg="la_top_1.gif";

    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']}'><img src='$img' width='{$imgwidth}' height='{$imgheight}' align='absmiddle' style='width:{$imgwidth}px;height:{$imgheight}px;border:1px solid #CCCCCC; padding:3px'></a></td></tr>";
echo " <tr><td align='center' height='21'><a href='{$list[$i]['href']}'>{$subject}</a></td></tr></table>";
?>
</td>
<? } ?>

<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
    echo "<td width=$col_width%>&nbsp;</td>";
}
?>

  <? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
  </tr>
</table>
정말 감사합니다.
잘 되네요..^^
너무 감사해요~~ 몇일을 고민했거든요..

중간에 몇가지 오타가 있었어요..
else-> ekse
그리고 max -> max_img 요것만 고치니깐 잘 되네요..^^
아 그랬군요.
기존에 사용하던 소스가 아니고,
모아이님이 올려놓은 소스를 편집하는 과정에 급한일이 생겨 부랴부랴 올려놓고 오타 및 점검을 못했었습니다.

혹시 다른 분들이 사용하실 수도 있어 말씀하신 부분은 수정해 놓았습니다.
^^
© SIRSOFT
현재 페이지 제일 처음으로