썸네일 이미지의 비율을 고정안할려면 어떻게 하나요. > 그누4 질문답변

그누4 질문답변

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

썸네일 이미지의 비율을 고정안할려면 어떻게 하나요. 정보

썸네일 이미지의 비율을 고정안할려면 어떻게 하나요.

본문

안녕하세요 .
궁금한게 있어서 문의좀 드리겠습니다. 일단 제가 아래의 갤러리를 사용하고 있습니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=62544&sca=%B0%B6%B7%AF%B8%AE&page=2gallery

근데 이미지가 비율대로 축소가 되지 않아서 전체이미지가 보이지 않고 잘려서 보입니다.
이걸 비율유지 하지않고 그냥 찌그러지더라도 전체이미지가 다 나오게 하고 싶습니다.

list.skin.php파일중에 아래의 어느 부분을 수정해야 할 것 같은데 어떻게 하는지 모르겠습니다.^^
알려주시면 감사드리겠습니다.

----------------------------------------------------------------------------------------------------------------------
<form name="fboardlist" method="post" style="margin:0px;">
<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="">
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td colspan='<?=$mod?>' height=0 bgcolor=#ffffff></td></tr>
<tr><td colspan='<?=$mod?>' height=25></td></tr>
<tr>
<?
for ($i=0; $i<count($list); $i++)
{
    if ($i && $i%$mod==0)
    echo "</tr><tr><td colspan='{$mod}' height=20></td></tr><tr>";
    $img = "<img src='$board_skin_path/img/noimage.gif' border=0 title='이미지 없음'>";
$image = $list[$i][file][0][file];
    //$thumb = $thumb_path.'/'.$list[$i][wr_id];
    $thumb = $thumb_path.'/'.$list[$i][file][0][file];
    if (!file_exists($thumb))
    {
        $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][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);

            if ($height < $thumb_height)
                $dst = imagecreatetruecolor($thumb_width, $height);
            else
                $dst = imagecreatetruecolor($thumb_width, $thumb_height);
            /*imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
            imagejpeg($dst, $thumb_path.'/'.$list[$i][file][0][file], $thumb_quality);
            chmod($thumb_path.'/'.$list[$i][file][0][file], 0606);*/

imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][file][0][file], $thumb_quality);
chmod($thumb_path.'/'.$list[$i][file][0][file], 0606);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $thumb_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}

  if (file_exists($thumb) && $list[$i][file][0][file]) {
$img = "<a href='$g4[path]/data/file/$bo_table/$image') class='highslide' onclick='return hs.expand(this)' ><img src='{$thumb}' width='{$thumb_width}' height='{$thumb_height}' border=0 style='border:0px solid #999999;'></a>";
} else {
preg_match("`<\s*img\s+src\s*=\s*['|\"]?([^'|\"\s]+://[^'|\"\s]+\.(gif|jpe?g|png))['|\"]?\s*[^>]+`i", $list[$i]['wr_content'], $images);

if (!empty($images[1])) {
$img_size = GetImageSize("$images[1]");
if($img_size[0] >= $img_size[1]) {
$imgper = $thumb_width/$img_size[0];
$thumb_height = $img_size[1]*$imgper;
}else{
$imgper = $thumb_height/$img_size[1];
$thumb_width = $img_size[0]*$imgper;
}

$img = "<a href='$g4[path]/data/file/$bo_table/$image') class='highslide' onclick='return hs.expand(this)' ><img src='{$images[1]}' width='{$thumb_width}' height='{$thumb_height}' align='absmiddle' border='0'></a>";
} else {
echo "";
}
}
  • 복사

댓글 전체

if ($height < $thumb_height)
                $dst = imagecreatetruecolor($thumb_width, $height);
            else
                $dst = imagecreatetruecolor($thumb_width, $thumb_height);
==>
 
                $dst = imagecreatetruecolor($thumb_width, $thumb_height);

,

imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
==>
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $thumb_height, $size[0], $size[1]);
© SIRSOFT
현재 페이지 제일 처음으로