갤러리게시판 이미지 비율 문제 > 그누4 질문답변

그누4 질문답변

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

갤러리게시판 이미지 비율 문제 정보

갤러리게시판 이미지 비율 문제

본문

갤러리게시판을 약간 변형하여 하나 사용중인데요.
섬네일 이미지가 원본이미지비율에 상관없이 섬네일 이미지크기 설정한 거에 맞춰서 나와서 문제입니다.
 
즉, 원본이 1000x500 이고, 섬네일 크기 지정한게 가로200 이라면 섬네일 이미지는 200x100으로 나와야 할텐데 그냥 200x200으로 나와서 원본비율이 무시됩니다.
 
이걸 해결할 방법이 없을까요?
 
아래는 해당부분 소스 입니다.
 
 
<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td height=10></td></tr></table>
<!-- 제목 -->
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<form name="fboardlist" method="post">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="sfl"  value="<?=$sfl?>">
<input type="hidden" name="stx"  value="<?=$stx?>">
<input type="hidden" name="spt"  value="<?=$spt?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="sw"   value="">
<? if ($is_admin) { ?><tr><td height=30 colspan='<?=$board[bo_gallery_cols]?>' style='padding-left:20px;'><INPUT onclick="if (this.checked) all_checked(true); else all_checked(false);" type=checkbox> 전체선택</td></tr><? } ?>
<tr>
<?
for ($i=0; $i<count($list); $i++)
{
    $title = "자세히보기";
    $content = cut_str(get_text($list[$i][wr_content]), 80);
 $subject = cut_str(get_text($list[$i][subject]), 20, '...');
 $img_width  = '124';  // 이미지 개당 가로크기
 $img_height = '98';  // 이미지 개당 세로크기
    $img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
    if (!file_exists($img) || !$list[$i][file][0][file])
        $img = "$board_skin_path/img/no_image.gif";
    $href = "$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}";
    $view_href = "$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}";
    if ($is_admin)
        $view_href = "$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}";
    $checkbox = "";
    if ($is_checkbox)
        $checkbox = "<input type=checkbox name=chk_wr_id[] value='{$list[$i][wr_id]}'>";
    $tr = "";
    if ($i && $i%$board[bo_gallery_cols]==0)
        $tr = "</tr><tr>";
    echo "$tr";
    echo <<<HEREDOC
    <td width="{$td_width}%" valign="top" align="center">
        <table border="0" cellpadding="0" cellspacing="0" style='border:0px solid #cccccc'>
        <tr>
            <td align=center><img src="$g4[path]/image/sianbox_top.gif" width="146" height="3"></td>
        </tr>
        <tr>
            <td align=center background="$g4[path]/image/sianbox_back.gif" height="110" style='word-break:break-all; padding:10 10 10 10;'>
   <a href="{$href}"><img src="{$img}" width='{$img_width}' height='{$img_height}' border="0" title="$title" style="border:0px solid #000000"></a>
  <tr><td><img src="$g4[path]/image/sianbox_down.gif" width="146" height="3"></td></tr>
  <tr><td height='25' align='center'>{$checkbox} <a class='sian' href='{$view_href}'>{$subject}</a>   
   </td>
        </tr>
        <tr><td height='10' align='center'><span>{$list[$i][datetime]}</span></td></tr>
        </table><br>
    </td>
HEREDOC;
}
// 나머지 td 를 채운다.
if (($cnt = $i%$list_mod) != 0)
    for ($k=$cnt; $k<$list_mod; $k++)
        echo "<td> </td>\n";
if ($i == 0)
    echo "<td colspan='$board[bo_gallery_cols]' height=50 align=center>게시물이 없습니다.</td>";
?>
</form>
</tr>
</table>

 
 
위에보면 가로크기와 세로크기를 지정했는데요. 만약 이미지 세로크기를 지정안하면 이미지가 아주 짜부되어서 납작하게 나옵니다.
  • 복사

댓글 전체

이미지 출력되는 부분을 다음처럼 height 없이 고쳐보세요.

<a href="{$href}"><img src="{$img}" width='{$img_width}'  border="0" title="$title" style="border:0px solid #000000"></a>
© SIRSOFT
현재 페이지 제일 처음으로