쿨한쏘로님의 스킨에서 섬네일 엑박... 도와주세요,,,, 정보
쿨한쏘로님의 스킨에서 섬네일 엑박... 도와주세요,,,,본문
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=100706&sca=%EC%B5%9C%EC%8B%A0%EA%B8%80&sfl=wr_subject%7C%7Cwr_content&stx=%EB%B8%94%EB%9E%99&sop=and
이 스킨을 사용하였구요.
GD지원하는 호스팅입니다. 근데, 메인에서 섬네일이 엑박으로 나오네요.
뭐가 잘못된걸까요.. php문외한이다보니 어렵네요...
latest.skin.php 소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = '80'; //썸네일 가로길이
$img_height = '90'; //썸네일 세로길이
$img_quality = '90'; //퀼리티 100이하로 설정
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb'; //썸네일 이미지 생성 디렉토리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">
<tr height="1">
<td colspan="3"></td>
</tr>
<tr>
<td></td>
<td>
<table cellpadding="0" cellspacing="2" width="100%" border="0">
<tr>
<td>
<table cellpadding="5" cellspacing="0" width="100%" border="0">
<tr height="25">
<td align="left">
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><font color="#B4B4B4" ><b><?=$board[bo_subject]?></b></font></a>
</td>
<td align="right"><span style="font-size: 12px; color: #646464; font-family:dotum; letter-spacing:-1;"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?>/img/more.gif" border="0"></a></span></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr height="1">
<td colspan="3"></td>
</tr>
</table>
<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">
<tr height="5"><td></td><td colspan="2"></td><td></td></tr>
<? for ($i=0; $i<count($list); $i++) {?>
<tr>
<td></td>
<td width="5"></td>
<td height="21">
<!-- 게시물 추출 글자 설정 시작 -->
<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<!--게시물 아래 점선 색상을 바꾸고 싶으시면 211,211,211부분을, 게시물 추출부분 세로 길이를 늘리시려면 25을 수정하세요-->
<td width="15%" height="25" valign=middle style="PADDING-LEFT: 1px; PADDING-BOTTOM: 0px; PADDING-TOP: 2px" style="border-bottom-width:0px; border-bottom-color:rgb(211,211,211); border-bottom-style:dotted;">
<?=$viewLayer?>
<?
// 게시물이 없으면 이미지 영역없음[2008-03-29]
if( count($list) ) {
$thumb = $thumb_path.'/'.$list[0][wr_id];
if (!file_exists($thumb)) {
$file = $list[0][file][0][path] .'/'. $list[0][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]);
imagepng($dst, $thumb_path.'/'.$list[0][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[0][wr_id], 0606);
}
}
if (file_exists($thumb)) $img_path = $thumb;
else {
// 최근게시물 본문 중 이미지태그를 검색하여 그 중 한개만 특정 사이즈로 크롭하여 보여준다.
// 뉴스웹진 스타일 [2008-03-28]
$data = $list[0]['wr_content'] ;
// 이미지 주소 찾기
preg_match('/img.*?src=(.*?) /i', $data, $url_img);
$img_path = $url_img[1]; // 그림 주소
$del_str_arr = array('"', "'");
$img_path = str_replace($del_str_arr, "", $img_path);
$img_path = trim($img_path);
}
// 이미지 경로가 없을 경우처리 [2008-03-28]
if( trim(strrchr($img_path, "/")) == '/' ) $img_path = '';
$img_path = $img_path ? $img_path : $latest_skin_path.'/img/noimg.gif';
?>
<a href='<?=$list[0][href]?>'><img src="<?=$img_path?>" width="<?=$img_width?>" height="<?=$img_height?>" border="0" /></a>
<? } ?>
</td>
<td width="100%" height="14" valign="middle" style="border-bottom-width:0px; border-bottom-color:rgb(211,211,211); border-bottom-style:dotted;">
<?
for ($i=0; $i<count($list); $i++) {
//날짜표시
$subject = $list[$i][subject];
$b_subject = "<strong>".$list[$i][subject]."<strong>";
?>
<table align="center" cellpadding="0" cellspacing="0" width="100%" height="20" border="0">
<tr>
<td width="1" align="center"></td>
<td><span style='color:#777777;font-weight:bold;'>ㆍ</span><a href='<?=$list[$i][href]?>'><span class="th6">
<?if ($list[$i][is_notice])
echo $b_subject;
else
echo $subject;
?></span></a>
<span style="font-size:7pt;font-family:tahoma;color:#C27F9A;vertical-align:1px;"><?=$list[$i][comment_cnt]?>
<?
echo " " . $list[$i]['icon_new'];
//echo " " . $list[$i]['icon_hot'];
//echo " " . $list[$i]['icon_file'];
//echo " " . $list[$i]['icon_link'];
//echo " " . $list[$i]['icon_secret'];
//echo "</td><td width=36 align=right>";
//echo "<font color=#bababa class=small>{$list[$i][datetime2]}</font>";
?>
</span>
</td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><font color=#6A6A6A>현재 등록된 글이 없습니다.</a><? } ?>
</table>
</tr>
</table>
<!--게시물 추출 글자 설정 끝-->
<td></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><? } ?>
<tr height="5"><td></td><td colspan="2"></td><td></td></tr>
<tr height="1">
<td colspan="4"></td>
</tr>
</table>
이 스킨을 사용하였구요.
GD지원하는 호스팅입니다. 근데, 메인에서 섬네일이 엑박으로 나오네요.
뭐가 잘못된걸까요.. php문외한이다보니 어렵네요...
latest.skin.php 소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = '80'; //썸네일 가로길이
$img_height = '90'; //썸네일 세로길이
$img_quality = '90'; //퀼리티 100이하로 설정
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb'; //썸네일 이미지 생성 디렉토리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">
<tr height="1">
<td colspan="3"></td>
</tr>
<tr>
<td></td>
<td>
<table cellpadding="0" cellspacing="2" width="100%" border="0">
<tr>
<td>
<table cellpadding="5" cellspacing="0" width="100%" border="0">
<tr height="25">
<td align="left">
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><font color="#B4B4B4" ><b><?=$board[bo_subject]?></b></font></a>
</td>
<td align="right"><span style="font-size: 12px; color: #646464; font-family:dotum; letter-spacing:-1;"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?>/img/more.gif" border="0"></a></span></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr height="1">
<td colspan="3"></td>
</tr>
</table>
<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">
<tr height="5"><td></td><td colspan="2"></td><td></td></tr>
<? for ($i=0; $i<count($list); $i++) {?>
<tr>
<td></td>
<td width="5"></td>
<td height="21">
<!-- 게시물 추출 글자 설정 시작 -->
<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<!--게시물 아래 점선 색상을 바꾸고 싶으시면 211,211,211부분을, 게시물 추출부분 세로 길이를 늘리시려면 25을 수정하세요-->
<td width="15%" height="25" valign=middle style="PADDING-LEFT: 1px; PADDING-BOTTOM: 0px; PADDING-TOP: 2px" style="border-bottom-width:0px; border-bottom-color:rgb(211,211,211); border-bottom-style:dotted;">
<?=$viewLayer?>
<?
// 게시물이 없으면 이미지 영역없음[2008-03-29]
if( count($list) ) {
$thumb = $thumb_path.'/'.$list[0][wr_id];
if (!file_exists($thumb)) {
$file = $list[0][file][0][path] .'/'. $list[0][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]);
imagepng($dst, $thumb_path.'/'.$list[0][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[0][wr_id], 0606);
}
}
if (file_exists($thumb)) $img_path = $thumb;
else {
// 최근게시물 본문 중 이미지태그를 검색하여 그 중 한개만 특정 사이즈로 크롭하여 보여준다.
// 뉴스웹진 스타일 [2008-03-28]
$data = $list[0]['wr_content'] ;
// 이미지 주소 찾기
preg_match('/img.*?src=(.*?) /i', $data, $url_img);
$img_path = $url_img[1]; // 그림 주소
$del_str_arr = array('"', "'");
$img_path = str_replace($del_str_arr, "", $img_path);
$img_path = trim($img_path);
}
// 이미지 경로가 없을 경우처리 [2008-03-28]
if( trim(strrchr($img_path, "/")) == '/' ) $img_path = '';
$img_path = $img_path ? $img_path : $latest_skin_path.'/img/noimg.gif';
?>
<a href='<?=$list[0][href]?>'><img src="<?=$img_path?>" width="<?=$img_width?>" height="<?=$img_height?>" border="0" /></a>
<? } ?>
</td>
<td width="100%" height="14" valign="middle" style="border-bottom-width:0px; border-bottom-color:rgb(211,211,211); border-bottom-style:dotted;">
<?
for ($i=0; $i<count($list); $i++) {
//날짜표시
$subject = $list[$i][subject];
$b_subject = "<strong>".$list[$i][subject]."<strong>";
?>
<table align="center" cellpadding="0" cellspacing="0" width="100%" height="20" border="0">
<tr>
<td width="1" align="center"></td>
<td><span style='color:#777777;font-weight:bold;'>ㆍ</span><a href='<?=$list[$i][href]?>'><span class="th6">
<?if ($list[$i][is_notice])
echo $b_subject;
else
echo $subject;
?></span></a>
<span style="font-size:7pt;font-family:tahoma;color:#C27F9A;vertical-align:1px;"><?=$list[$i][comment_cnt]?>
<?
echo " " . $list[$i]['icon_new'];
//echo " " . $list[$i]['icon_hot'];
//echo " " . $list[$i]['icon_file'];
//echo " " . $list[$i]['icon_link'];
//echo " " . $list[$i]['icon_secret'];
//echo "</td><td width=36 align=right>";
//echo "<font color=#bababa class=small>{$list[$i][datetime2]}</font>";
?>
</span>
</td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><font color=#6A6A6A>현재 등록된 글이 없습니다.</a><? } ?>
</table>
</tr>
</table>
<!--게시물 추출 글자 설정 끝-->
<td></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><? } ?>
<tr height="5"><td></td><td colspan="2"></td><td></td></tr>
<tr height="1">
<td colspan="4"></td>
</tr>
</table>
댓글 전체
일단 폴더가 생성되어있는지 보시고요
생성되어있다면 이미지가 생성되어있는지 확인해보세요
폴더는 소스 상단에 보면
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
위와 같이 생성하게끔 되어있는데요
mkdir($thumb_path, 0707);
chmod($thumb_path, 0707);
앞에 @ 를 빼고 사용하시면 오류메시지가 나옵니다
생성되어있다면 이미지가 생성되어있는지 확인해보세요
폴더는 소스 상단에 보면
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
위와 같이 생성하게끔 되어있는데요
mkdir($thumb_path, 0707);
chmod($thumb_path, 0707);
앞에 @ 를 빼고 사용하시면 오류메시지가 나옵니다
넓은마인드님 답벼 고맙습니다.
확인해봤는데 정상적으로 @가 붙어있어요. 근데 data - file - 게시판id폴더 <--- 여기엔 파일이 정상적으로 있는데, 섬네일폴더에는 16이라는 파일이 하나 있어요. 확장자도 없구요... 메모장아이콘임..
섬네일이 하나밖에 안된건가요?
확인해봤는데 정상적으로 @가 붙어있어요. 근데 data - file - 게시판id폴더 <--- 여기엔 파일이 정상적으로 있는데, 섬네일폴더에는 16이라는 파일이 하나 있어요. 확장자도 없구요... 메모장아이콘임..
섬네일이 하나밖에 안된건가요?
썸네일 파일은 위 소스 상
/data/file/게시판id폴더/thumb/ 안에 존재해야 합니다.
엑박으로 뜨신다는게 엑박으로뜨는 이미지 파일명 확인해보시고
해당 파일이 해당 폴더안에있는지 확인해보셔야 할꺼 같습니다
/data/file/게시판id폴더/thumb/ 안에 존재해야 합니다.
엑박으로 뜨신다는게 엑박으로뜨는 이미지 파일명 확인해보시고
해당 파일이 해당 폴더안에있는지 확인해보셔야 할꺼 같습니다