게시판 VIEW에서 사진 줄이기.. > 그누4 질문답변

그누4 질문답변

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

게시판 VIEW에서 사진 줄이기.. 정보

게시판 VIEW에서 사진 줄이기..

본문

오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.

오류 주소 : http://famrich.com/famrich/bbs/board.php?bo_table=photo&wr_id=9

∧위의 주소처럼 사진이 너무 커서 일정한 크기(예를 들어 400*400)로

나오게 수정하고 싶은데욤..

소스를 보니

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

<!-- 게시글 보기 시작 -->
<DIV style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 405px"> <!-- 스크롤바 시작되는 바깥 테이블 오버플로우 시작 -->
<table width="<?=$width?>" align="center" cellpadding="0" cellspcing="0"><tr><td>

<!-- 링크 버튼 -->
<?
ob_start();
?>
<?
$link_buttons = ob_get_contents();
ob_end_flush();
?>

<table width="100%" cellspacing="0" cellpadding="0">
<tr><td height=2></td></tr>
<tr><td height=30 bgcolor=#F8F8F9 style="padding:5 0 5 0;">&nbsp;&nbsp;<strong>
<?
if ($is_category) {
echo ($category_name ? "$view[ca_name] > " : "");
echo ($view[wr_9] ? "$view[wr_9] > " : "");
echo ($view[wr_10] ? "$view[wr_10] > " : "");
}
?><?=$view[subject]?></strong></td></tr>
<tr><td height=30>&nbsp;&nbsp;<font color=#7A8FDB>글쓴이</font> : <?=$view[name]?><? if ($is_ip_view) { echo "&nbsp;($ip)"; } ?>&nbsp;&nbsp;&nbsp;&nbsp;
      <font color=#7A8FDB>날짜</font> : <?=substr($view[wr_datetime],2,14)?>&nbsp;&nbsp;&nbsp;&nbsp;
      <font color=#7A8FDB>조회</font> : <?=$view[wr_hit]?>&nbsp;&nbsp;&nbsp;&nbsp;
      <? if ($is_good) { ?><font color=#7A8FDB>추천</font> : <?=$view[wr_good]?>&nbsp;&nbsp;&nbsp;&nbsp;<?}?>
      <? if ($is_nogood) { ?><font color=#7A8FDB>비추천</font> : <?=$view[wr_nogood]?>&nbsp;&nbsp;&nbsp;&nbsp;<?}?></td></tr>
<tr></tr>

<? if ($trackback_url) { ?>

<?}?>

<?
// 가변 파일
$cnt = 0;
for ($i=0; $i<count($view[file]); $i++)
{
    if ($view[file][$i][source] && !$view[file][$i][view])
    //if ($view[file][$i][source])
    {
        $cnt++;
        echo "<tr><td height=22>&nbsp;&nbsp;<img src='{$board_skin_path}/img/icon_file.gif' align=absmiddle> <a href='{$view[file][$i][href]}' title='{$view[file][$i][content]}'><strong>{$view[file][$i][source]}</strong> ({$view[file][$i][size]}), Down : {$view[file][$i][download]}, {$view[file][$i][datetime]}</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=22>&nbsp;&nbsp;<img src='{$board_skin_path}/img/icon_link.gif' align=absmiddle> <a href='{$view[link_href][$i]}' target=_blank><strong>{$link}</strong> ({$view[link_hit][$i]})</a></td></tr>";
    }
}
?>

<tr><td height=1 bgcolor=#E7E7E7></td></tr>
<tr>
    <td height="150" style='word-break:break-all; padding:10px;' bgcolor=#F8F8F9>
        <!-- <font color=#ff8800><b>목록에서 작은 이미지로 확인하신 후 ↑ 위의 파일을 다운로드 받아서 사용하세요.</b></font>
        <br><br> -->
        <?
        // 파일 출력
        for ($i=0; $i<=count($view[file]); $i++)
        {
            if ($view[file][$i][view])
            {
                echo $view[file][$i][view];
                echo "<p>" ;
                /*
                $exif = @exif_read_data("{$view[file][$i][path]}/{$view[file][$i][file]}");
                if (isset($exif[Make]) || isset($exif[Model])) echo "카메라모델 : $exif[Make] - $exif[Model]<br>";
                if (isset($exif[DateTimeOriginal])) echo "촬영일시 : $exif[DateTimeOriginal]<br>";
                if (isset($exif[COMPUTED][Width]) || isset($exif[COMPUTED][Height])) echo "이미지크기 : {$exif[COMPUTED][Width]} x {$exif[COMPUTED][Height]} 픽셀<br>";
                if (isset($exif[COMPUTED][ApertureFNumber])) echo "조리개 : {$exif[COMPUTED][ApertureFNumber]}<br>";
                if (isset($exif[ISOSpeedRatings])) echo "ISO : $exif[ISOSpeedRatings]<br>";
                if (isset($exif[WhiteBalance])) echo "화이트밸런스 : {$exif[WhiteBalance]}<br>";
                if (isset($exif[ExposureTime])) echo "노출시간 : $exif[ExposureTime] 초<br>";
                if (isset($exif[ExposureBiasValue])) echo "노출보정 : $exif[ExposureBiasValue]<br>";
                if (isset($exif[COMPUTED][CCDWidth])) echo "CCD : {$exif[COMPUTED][CCDWidth]}<br>";
                if (isset($exif[Flash])) echo "플래쉬 : {$exif[Flash]}<br>";
                echo "<p>" ;
                */
                //print_r2($exif);
            }
        }
        ?>

        <span class="ct lh"><?=$view[content];?></span>
        <?//echo $view[rich_content]; // 과 같은 코드를 사용할 경우?>
        <!-- 테러 태그 방지용 --></xml></xmp><a href=""></a><a href=''></a>
        <? if ($is_signature) { echo "<br>$signature<br><br>"; } // 서명 출력 ?></td>
</tr>
</table>

<?
include_once("./view_comment.php");
?>

<?=$link_buttons?>
<table width='100%' cellpadding=0 cellspacing=0>
<tr height=35>
    <td width=75%>
        <? if ($search_href) { echo "<a href=\"$search_href\"><img src='$board_skin_path/img/btn_search_list.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> "; ?>

        <? if ($write_href) { echo "<a href=\"$write_href\"><img src='$board_skin_path/img/btn_write.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 ($update_href) { echo "<a href=\"$update_href\"><img src='$board_skin_path/img/btn_update.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 ($good_href) { echo "<a href=\"$good_href\" target='hiddenframe'><img src='$board_skin_path/img/btn_good.gif' border='0' align='absmiddle'></a> "; } ?>
        <? if ($nogood_href) { echo "<a href=\"$nogood_href\" target='hiddenframe'><img src='$board_skin_path/img/btn_nogood.gif' border='0' align='absmiddle'></a> "; } ?>

        <? if ($scrap_href) { echo "<a href=\"javascript:;\" onclick=\"win_scrap('./scrap_popin.php?bo_table=$bo_table&wr_id=$wr_id');\"><img src='$board_skin_path/img/btn_scrap.gif' border='0' align='absmiddle'></a> "; } ?>

        <? 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> "; } ?>
    </td>
    <td width=25% align=right>
        <? if ($prev_href) { echo "<a href=\"$prev_href\" title=\"$prev_wr_subject\"><img src='$board_skin_path/img/btn_prev.gif' border='0' align='absmiddle'></a>&nbsp;"; } ?>
        <? if ($next_href) { echo "<a href=\"$next_href\" title=\"$next_wr_subject\"><img src='$board_skin_path/img/btn_next.gif' border='0' align='absmiddle'></a>&nbsp;"; } ?>
    </td>
</tr>
</table>

</td></tr></table>
</DIV><!-- 스크롤바 시작되는 바깥 테이블 오버플로우 끝 -->

<script language="JavaScript">
// HTML 로 넘어온 <img ... > 태그의 폭이 테이블폭보다 크다면 테이블폭을 적용한다.
function resize_image()
{
    var target = document.getElementsByName('target_resize_image[]');
    var image_width = parseInt('<?=$board[bo_image_width]?>');
    var image_height = 0;

    for(i=0; i<target.length; i++) {
        // 원래 사이즈를 저장해 놓는다
        target[i].tmp_width  = target[i].width;
        target[i].tmp_height = target[i].height;
        // 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
        if(target[i].width > image_width) {
            image_height = parseFloat(target[i].width / target[i].height)
            target[i].width = image_width;
            target[i].height = parseInt(image_width / image_height);
        }
    }
}

window.onload = resize_image;
</script>
<!-- 게시글 보기 끝 -->

이렇게 나와욤..

어딜 어떻게 고쳐야지 이미지가 커지지않고 스크롤도 안생기게 할까요?

고수님들 한 수 가르쳐 주십시오..꾸벅..(--)(__);;
  • 복사

댓글 전체

게시판 관리자 설정에서 `이미지 폭 크기` 를 적절히 줄여주세요.
큰 사진도 줄여서 보여줍니다.

복잡하지만 업로드할때 아예 파일을 규격화해서 정해진 크기로 줄이는 방법도 있습니다.
© SIRSOFT
현재 페이지 제일 처음으로