썸네일 이미지를 리사이즈하고싶습니다 정보
썸네일 이미지를 리사이즈하고싶습니다본문
<style>
.photo_img img{ border:3px solid #545454; width:144px; height:54px; }
.text_a a{ color:#C9C9C9; }
.text_a a:hover{ color:#C9C9C9; }
</style>
<div style="height:12px; line-height:1px; font-size:1px;"> </div>
<!-- 게시판 목록 시작 -->
<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0><tr><td>
<!-- 분류 셀렉트 박스, 게시물 몇건, 관리자화면 링크 -->
<table border=0 width="100%" cellspacing="0" cellpadding="0">
<tr height="25">
<td width="50%">
<form name="fcategory" method="get" style="margin:0; padding:0;">
<? if ($is_category) { ?>
<select name=sca onchange="location='<?=$category_location?>'+this.value;">
<option value=''>전체</option>
<?=$category_option?>
</select>
<? } ?>
</form>
</td>
<td align="right">
<img src="<?=$board_skin_path?>/img/icon_total.gif" align=absmiddle>
<span style="color:#888888; font-weight:bold;">Total <?=number_format($total_count)?></span>
<? if ($rss_href) { ?><a href='<?=$rss_href?>'><img src='<?=$board_skin_path?>/img/btn_rss.gif' border=0 align=absmiddle></a><?}?>
<? if ($admin_href) { ?><a href="<?=$admin_href?>"><img src="<?=$board_skin_path?>/img/btn_admin.gif" title="관리자" align="absmiddle"></a><?}?>
</td>
</tr>
<tr><td height=5></td></tr>
</table>
<!-- 제목 -->
<form name="fboardlist" method="post" style="margin:0;">
<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% border=0 cellpadding=0 cellspacing=0 style="font-weight:bold; color:#c9c9c9;" bgcolor="#222222;">
<tr height=34 align=center>
<td width=50>번호</td>
<? if ($is_checkbox) { ?><td width=40><input onclick="if (this.checked) all_checked(true); else all_checked(false);" type=checkbox></td><?}?>
<td>제 목</td>
<?/**/?><td width=80><?=subject_sort_link('wr_datetime', $qstr2, 1)?><font style="color:#c9c9c9;">날짜</font></a></td>
<td width=50><?=subject_sort_link('wr_hit', $qstr2, 1)?><font style="color:#c9c9c9;">조회</font></a></td><?/**/?>
<!--<td width=40>날짜</td>
<td width=50>조회</td>-->
<?/*?><td width=40 title='마지막 코멘트 쓴 시간'><?=subject_sort_link('wr_last', $qstr2, 1)?>최근</a></td><?*/?>
<? if ($is_good) { ?><td width=40><?=subject_sort_link('wr_good', $qstr2, 1)?>추천</a></td><?}?>
<? if ($is_nogood) { ?><td width=40><?=subject_sort_link('wr_nogood', $qstr2, 1)?>비추천</a></td><?}?>
</tr>
</table>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<!-- 목록 -->
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$board_skin_path/img/noimage.gif' border=0 title='이미지 없음'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
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
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0666);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
else
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
현재 소스입니다 리사이즈 소스가 들어가있는거같은데 적용이 안됩니다
어딜 수정해야되는지 ㅠ,ㅠ 완전초보입니당
.photo_img img{ border:3px solid #545454; width:144px; height:54px; }
.text_a a{ color:#C9C9C9; }
.text_a a:hover{ color:#C9C9C9; }
</style>
<div style="height:12px; line-height:1px; font-size:1px;"> </div>
<!-- 게시판 목록 시작 -->
<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0><tr><td>
<!-- 분류 셀렉트 박스, 게시물 몇건, 관리자화면 링크 -->
<table border=0 width="100%" cellspacing="0" cellpadding="0">
<tr height="25">
<td width="50%">
<form name="fcategory" method="get" style="margin:0; padding:0;">
<? if ($is_category) { ?>
<select name=sca onchange="location='<?=$category_location?>'+this.value;">
<option value=''>전체</option>
<?=$category_option?>
</select>
<? } ?>
</form>
</td>
<td align="right">
<img src="<?=$board_skin_path?>/img/icon_total.gif" align=absmiddle>
<span style="color:#888888; font-weight:bold;">Total <?=number_format($total_count)?></span>
<? if ($rss_href) { ?><a href='<?=$rss_href?>'><img src='<?=$board_skin_path?>/img/btn_rss.gif' border=0 align=absmiddle></a><?}?>
<? if ($admin_href) { ?><a href="<?=$admin_href?>"><img src="<?=$board_skin_path?>/img/btn_admin.gif" title="관리자" align="absmiddle"></a><?}?>
</td>
</tr>
<tr><td height=5></td></tr>
</table>
<!-- 제목 -->
<form name="fboardlist" method="post" style="margin:0;">
<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% border=0 cellpadding=0 cellspacing=0 style="font-weight:bold; color:#c9c9c9;" bgcolor="#222222;">
<tr height=34 align=center>
<td width=50>번호</td>
<? if ($is_checkbox) { ?><td width=40><input onclick="if (this.checked) all_checked(true); else all_checked(false);" type=checkbox></td><?}?>
<td>제 목</td>
<?/**/?><td width=80><?=subject_sort_link('wr_datetime', $qstr2, 1)?><font style="color:#c9c9c9;">날짜</font></a></td>
<td width=50><?=subject_sort_link('wr_hit', $qstr2, 1)?><font style="color:#c9c9c9;">조회</font></a></td><?/**/?>
<!--<td width=40>날짜</td>
<td width=50>조회</td>-->
<?/*?><td width=40 title='마지막 코멘트 쓴 시간'><?=subject_sort_link('wr_last', $qstr2, 1)?>최근</a></td><?*/?>
<? if ($is_good) { ?><td width=40><?=subject_sort_link('wr_good', $qstr2, 1)?>추천</a></td><?}?>
<? if ($is_nogood) { ?><td width=40><?=subject_sort_link('wr_nogood', $qstr2, 1)?>비추천</a></td><?}?>
</tr>
</table>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<!-- 목록 -->
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$board_skin_path/img/noimage.gif' border=0 title='이미지 없음'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
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
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0666);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
else
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
현재 소스입니다 리사이즈 소스가 들어가있는거같은데 적용이 안됩니다
어딜 수정해야되는지 ㅠ,ㅠ 완전초보입니당
댓글 전체
사용 스킨에서 썸네일 이미지 너비 높이를 지정 하는 곳 찾아 보세요.
리스트 스킨 상단에 img_width, img_height 등 있는지
해당 게시판 여분 1,2에 반영하는 등의 스킨 설명 참고
리스트 스킨 상단에 img_width, img_height 등 있는지
해당 게시판 여분 1,2에 반영하는 등의 스킨 설명 참고
완전 초보라 ㅠ.ㅠ 눈이 트롤이라 ㅠ.ㅠ
.photo_img img{ border:3px solid #545454; width:144px; height:54px; } 이부분이 사이즈 조정하는곳같은데
여기서 조정하면 짤린 부분만큼 늘어날뿐이고 사이즈안으로 이미지가 들어오질않고있어요 ㅠ.ㅠ
여기서 조정하면 짤린 부분만큼 늘어날뿐이고 사이즈안으로 이미지가 들어오질않고있어요 ㅠ.ㅠ
리스트 스킨 위쪽에
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
...
생략
...
$img_width = "140"; // 썸 너비용 추가 ★★
$img_height = "50"; // 썸 높이용 추가 ★★
?>
적용 테스트 해 보세요.
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
...
생략
...
$img_width = "140"; // 썸 너비용 추가 ★★
$img_height = "50"; // 썸 높이용 추가 ★★
?>
적용 테스트 해 보세요.
적용했는데 ㅠ.ㅠ 똑같이 짤려서 나오네요
<style>
.photo_img img{ border:3px solid #545454; width:144px; height:54px; }
.text_a a{ color:#C9C9C9; }
위 소스 위쪽에 $thumb_path 이런 변수 있나요?
스킨 자료실 파일인 경우 어떤 스킨 적용하신 건지 해당 링크를 남기시는게 확인이 빠를 듯 싶네요.
.photo_img img{ border:3px solid #545454; width:144px; height:54px; }
.text_a a{ color:#C9C9C9; }
위 소스 위쪽에 $thumb_path 이런 변수 있나요?
스킨 자료실 파일인 경우 어떤 스킨 적용하신 건지 해당 링크를 남기시는게 확인이 빠를 듯 싶네요.
음 스킨자료실에서 받은스킨이 아니라 제작의뢰해서 만든 스킨이라서 더욱더 힘든거같아요 그리구 아까 말씀하신 $img_ 이부분은 적용이 되어있네요$thumb_path = $data_path.'/thumb'; 이 변수도 있구요
근데 이미지가 짤려서 나오니 이거원 ㅠ.ㅠ
근데 이미지가 짤려서 나오니 이거원 ㅠ.ㅠ
짤려 나온다는 이미지에서 마우스 오른쪽 버튼 - 속성 - 주소 복사 해서 남겨 보세요.
(썸생성 상태에서 크기 문제인지, 원본 출력상태인지 체크 위해)
(썸생성 상태에서 크기 문제인지, 원본 출력상태인지 체크 위해)
썸은 생성 되었네요.
$img 출력 부분(위 소스에는 없는 아래쪽 - 제목이랑 출력되는) 하고 위의 속성 클릭해서 나오는 픽셀 크기 남겨 보세요. [앞서 표현하신 .photo_img img 체크용]
$img 출력 부분(위 소스에는 없는 아래쪽 - 제목이랑 출력되는) 하고 위의 속성 클릭해서 나오는 픽셀 크기 남겨 보세요. [앞서 표현하신 .photo_img img 체크용]
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$board_skin_path/img/noimage.gif' border=0 title='이미지 없음'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
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
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0666);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
else
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?>
<tr align=center>
<td width=50>
이부분 말씀하시는건가요?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$board_skin_path/img/noimage.gif' border=0 title='이미지 없음'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
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
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0666);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
else
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?>
<tr align=center>
<td width=50>
이부분 말씀하시는건가요?
높이만 잘려진(가려진) 형태로 보이시나요?
height:54px; } 이 부분 min-height:54px; }
로 수정 후 우선 확인 해 보신 후
속성 - 이미지 픽셀 크기하고, 위 소스 아래쪽 - 제목 출력 부분이 필요 - .photo_img img{ 적용된 것 체크)
<?=$img> 소스 영역 남겨 보세요.
height:54px; } 이 부분 min-height:54px; }
로 수정 후 우선 확인 해 보신 후
속성 - 이미지 픽셀 크기하고, 위 소스 아래쪽 - 제목 출력 부분이 필요 - .photo_img img{ 적용된 것 체크)
<?=$img> 소스 영역 남겨 보세요.
쪽지로 전체 소스를 보내드렸습니다 ㅠ.ㅠ
설정 영역에 이미지가 가려지는 것에 대한 문제 아닌 썸네일 생성시 이미지 세로가 잘리는 것에 대한 답변이 필요한 내용
세로 안 자르고 처리는
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $img_height, $size[0], $size[1]); // $img_height로 수정하면 됨
최종 : 자르지 않고 가로 세로 비율유지 필요, 화질고려
세로 안 자르고 처리는
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $img_height, $size[0], $size[1]); // $img_height로 수정하면 됨
최종 : 자르지 않고 가로 세로 비율유지 필요, 화질고려