최신글 이미지 크기 조절이 안되요~ 정보
최신글 이미지 크기 조절이 안되요~본문
댓글 전체
보라색으로 나오는 것은 <img src="이미지경로" border=0>로 border값을 지정해주면 됩니다.
이미지크기는 소스를 한번 올려보시겠어요?
이미지크기는 소스를 한번 올려보시겠어요?
답변 감사합니다^^ 아래는 소스입니다~
<?
if (!defined("_GNUBOARD_")) exit; // 개별 ?˜ì´ì§? ?‘ê·¼ 불ê?
$cols = 1; // ?´ë?ì§? ê°?로갯??// ?´ë?ì§? ?¸ë¡œ ê°?ˆ˜??메인?ì„œ ì§???ì´??´ë?ì§? ??
$image_h = 1; // ?´ë?ì§? ?í•˜ 간격
$col_width = (int)(99 / $cols);
$img_width = 20; //?¸ë„¤??ê°?로길??
$img_height = 20; //?¸ë„¤???¸ë¡œê¸¸ì´
$img_quality = 100; //?¼ë¦¬??100?´í•˜ë¡??¤ì • ?¼ë? phpë²„ì „?ì„œ??10?´í•˜???˜ë¡œ 처리 ?????ˆì‚¼
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 ?´ìƒ ë²„ì „???¤ì¹˜?˜ì–´ ?ˆì–´???¬ìš©?????ˆëŠ” 갤러ë¦?게시???…니??");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_img_list'; //?¸ë„¤???´ë?ì§? ?ì„± ?”ë ‰? 리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?><style type="text/css">
<!--
.style3 {font-size: x-small}
-->
</style>
<table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8%" height="25" class="Blueb" style="padding-left:7"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"><img src="<?=$latest_skin_path?>/img/gong.gif"></td>
<td width="92%" align="right" style="padding-right:5"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"><img src="<?=$latest_skin_path?>/img/box02_more.gif" width="33" height="5" border="0"></a></td>
</tr>
<tr>
<td height="2" colspan="2"></td>
</tr>
<tr>
<td colspan="2" height="6"></td>
</tr>
</table>
<? for ($i=0; $i<count($list); $i++) { ?>
<?
$wr_content = "<a href='{$list[$i]['href']}'>".cut_str(strip_tags($list[$i]['wr_content']), 500, '...')."</a>";
// if ($i>0 && $i%$cols==0) { echo "<td colspan='$cols' height='$image_h'></td><tr>"; }
$img = "<img src='$g4_path/img/noimage.gif' border=1 width='$img_width' height='$img_height' title='?´ë?ì§? ?†ìŒ' align=left style='margin-right:5px; border:1 #222222 solid;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// ?¬ë„¤?¼ê³¼ ?ˆë¡œ ?¬ë¦°?Œì¼ ? 짜ë¥?비교?˜ì—¬ ?ˆë„¤?¼ì„ ê°±ì‹ ?˜ê¸°?„í•´??ì§??´ë‹¤.
if ( file_exists($thumb) && (filemtime($thumb) < filemtime($list[$i][file][0][path] .'/'. $list[$i][file][0][file])) ) {
@unlink($thumb);
}
// ?¸ë„¤???´ë?ì§?ê°? 존재?˜ì? ?ŠëŠ”?¤ë©´
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// ?…ë¡œ?œëœ ?Œì¼???´ë?ì§??¼ë©´
//echo $i;
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
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
$width = (int)($size[0] * $rate);
// 계산???¸ë„¤???´ë?ì§????’이ê°? ?¤ì •???´ë?ì§????’이보다 ?‘다ë©?
$dst = imagecreatetruecolor($img_width, $img_height);
if ($height < $img_height) { // 계산???´ë?ì§? ?’이ë¡?복사ë³??´ë?ì§? ?ì„±
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $img_height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
} else { // ?¤ì •???´ë?ì§? ?’이ë¡?복사ë³??´ë?ì§? ?ì„±
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
}
//echo $i;
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
?>
<?
$datetime = substr($list[$i][wr_datetime],0,10);
$datetime2 = $list[$i][wr_datetime];
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($row['bo_new'] * 3600))) $comment_new = "new";
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$a[$i] = array(
"wr_date"=>$datetime2,
);
?>
<?
$rw_subject = cut_str(stripslashes($list[$i][subject]),$subject_size,'..');
$a_link="<a href='{$list[$i][href]}'>$rw_subject</a>";
$a_img="<a href='{$list[$i][href]}'>$img</a>";
$a_comment="<a href=\"{$list[$i][comment_href]}\"><span class='commentFont'>{$list[$i]['comment_cnt']}</span></a>";
$rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more');
$rw_content = strip_tags($rw_content);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><table width="95%" border="0" cellspacing="0" cellpadding="0" style="border-bottom-width:1; border-bottom-color:white; border-bottom-style:dashed;">
<tr>
<td width="23" height="58" valign="top"><table width="29%" border="0" cellpadding="2" cellspacing="1" >
<tr>
<td ><?=$a_img?></td>
</tr>
</table></td>
<td width="10"></td>
<td width="1093" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="4"><?
echo "<a href='{$list[$i]['href']}' class=\"b\">";
echo "<font style='font-family:??; font-size:9pt; color:#333333;'>{$list[$i]['subject']}";
echo "</a>";
?></td>
</tr>
<tr>
<td height="10"> <p>
<?=$wr_content?>
</p></td>
</tr>
<tr>
<td></td>
</tr>
<!--
<tr>
<td class="gray8A">ê¸??´ì´ : 매립?¸ì‚¬?´ë“œ</td>
</tr>
-->
</table></td>
</tr>
</table></td>
</tr><td height="10"></td>
</table>
<?
}
?>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 ?˜ì´ì§? ?‘ê·¼ 불ê?
$cols = 1; // ?´ë?ì§? ê°?로갯??// ?´ë?ì§? ?¸ë¡œ ê°?ˆ˜??메인?ì„œ ì§???ì´??´ë?ì§? ??
$image_h = 1; // ?´ë?ì§? ?í•˜ 간격
$col_width = (int)(99 / $cols);
$img_width = 20; //?¸ë„¤??ê°?로길??
$img_height = 20; //?¸ë„¤???¸ë¡œê¸¸ì´
$img_quality = 100; //?¼ë¦¬??100?´í•˜ë¡??¤ì • ?¼ë? phpë²„ì „?ì„œ??10?´í•˜???˜ë¡œ 처리 ?????ˆì‚¼
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 ?´ìƒ ë²„ì „???¤ì¹˜?˜ì–´ ?ˆì–´???¬ìš©?????ˆëŠ” 갤러ë¦?게시???…니??");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_img_list'; //?¸ë„¤???´ë?ì§? ?ì„± ?”ë ‰? 리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?><style type="text/css">
<!--
.style3 {font-size: x-small}
-->
</style>
<table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8%" height="25" class="Blueb" style="padding-left:7"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"><img src="<?=$latest_skin_path?>/img/gong.gif"></td>
<td width="92%" align="right" style="padding-right:5"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"><img src="<?=$latest_skin_path?>/img/box02_more.gif" width="33" height="5" border="0"></a></td>
</tr>
<tr>
<td height="2" colspan="2"></td>
</tr>
<tr>
<td colspan="2" height="6"></td>
</tr>
</table>
<? for ($i=0; $i<count($list); $i++) { ?>
<?
$wr_content = "<a href='{$list[$i]['href']}'>".cut_str(strip_tags($list[$i]['wr_content']), 500, '...')."</a>";
// if ($i>0 && $i%$cols==0) { echo "<td colspan='$cols' height='$image_h'></td><tr>"; }
$img = "<img src='$g4_path/img/noimage.gif' border=1 width='$img_width' height='$img_height' title='?´ë?ì§? ?†ìŒ' align=left style='margin-right:5px; border:1 #222222 solid;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// ?¬ë„¤?¼ê³¼ ?ˆë¡œ ?¬ë¦°?Œì¼ ? 짜ë¥?비교?˜ì—¬ ?ˆë„¤?¼ì„ ê°±ì‹ ?˜ê¸°?„í•´??ì§??´ë‹¤.
if ( file_exists($thumb) && (filemtime($thumb) < filemtime($list[$i][file][0][path] .'/'. $list[$i][file][0][file])) ) {
@unlink($thumb);
}
// ?¸ë„¤???´ë?ì§?ê°? 존재?˜ì? ?ŠëŠ”?¤ë©´
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// ?…ë¡œ?œëœ ?Œì¼???´ë?ì§??¼ë©´
//echo $i;
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
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
$width = (int)($size[0] * $rate);
// 계산???¸ë„¤???´ë?ì§????’이ê°? ?¤ì •???´ë?ì§????’이보다 ?‘다ë©?
$dst = imagecreatetruecolor($img_width, $img_height);
if ($height < $img_height) { // 계산???´ë?ì§? ?’이ë¡?복사ë³??´ë?ì§? ?ì„±
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $img_height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
} else { // ?¤ì •???´ë?ì§? ?’이ë¡?복사ë³??´ë?ì§? ?ì„±
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
}
//echo $i;
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
?>
<?
$datetime = substr($list[$i][wr_datetime],0,10);
$datetime2 = $list[$i][wr_datetime];
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($row['bo_new'] * 3600))) $comment_new = "new";
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$a[$i] = array(
"wr_date"=>$datetime2,
);
?>
<?
$rw_subject = cut_str(stripslashes($list[$i][subject]),$subject_size,'..');
$a_link="<a href='{$list[$i][href]}'>$rw_subject</a>";
$a_img="<a href='{$list[$i][href]}'>$img</a>";
$a_comment="<a href=\"{$list[$i][comment_href]}\"><span class='commentFont'>{$list[$i]['comment_cnt']}</span></a>";
$rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more');
$rw_content = strip_tags($rw_content);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><table width="95%" border="0" cellspacing="0" cellpadding="0" style="border-bottom-width:1; border-bottom-color:white; border-bottom-style:dashed;">
<tr>
<td width="23" height="58" valign="top"><table width="29%" border="0" cellpadding="2" cellspacing="1" >
<tr>
<td ><?=$a_img?></td>
</tr>
</table></td>
<td width="10"></td>
<td width="1093" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="4"><?
echo "<a href='{$list[$i]['href']}' class=\"b\">";
echo "<font style='font-family:??; font-size:9pt; color:#333333;'>{$list[$i]['subject']}";
echo "</a>";
?></td>
</tr>
<tr>
<td height="10"> <p>
<?=$wr_content?>
</p></td>
</tr>
<tr>
<td></td>
</tr>
<!--
<tr>
<td class="gray8A">ê¸??´ì´ : 매립?¸ì‚¬?´ë“œ</td>
</tr>
-->
</table></td>
</tr>
</table></td>
</tr><td height="10"></td>
</table>
<?
}
?>
올려주신 파일에서 87번째줄.
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
을
if (file_exists($thumb))
$img = "<img src='$thumb' width=원하는 넓이 height=원하는 높이 border=0>";
로 바꿔보세요.
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
을
if (file_exists($thumb))
$img = "<img src='$thumb' width=원하는 넓이 height=원하는 높이 border=0>";
로 바꿔보세요.
앗! 감사합니다~!! 덕분에 해결 되었어요^^
그런데 사진이미지크기와 설정한 크기가 같은데도 사진 화질이 안좋게 나오는건 무엇때문이죠????ㅜㅜ
퀄리티 99나 100으로 해도 그래요 ㅠㅠ
그런데 사진이미지크기와 설정한 크기가 같은데도 사진 화질이 안좋게 나오는건 무엇때문이죠????ㅜㅜ
퀄리티 99나 100으로 해도 그래요 ㅠㅠ
갤러리게시판 이미지조절 해결법