최신글 썸네일 추출관련 질문이염! 정보
최신글 썸네일 추출관련 질문이염!본문
최신글 스킨을 짜집기로 만들어서 그런지
최신글 리스트에 썸네일을 보면
어떤건 정상적으로 나오는데
또 어떤건 게시물과 상관없은 썸네일이 나오는데..
초보라 아무리 뒤져봐도 답이 안나오네요
이스킨 저스킨 썸네일출력되는 스킨들 소스 다 훑어보고 바꿔보아도
똑같은 현상이...
http://www.styledb.com/?mw_main=G04
여기서 위에 이야기방, 포토존, 게임/동영상 메뉴를 클릭해보시면
썸네일이 중복되어 나오는게 보이실거에요 ㅠㅠ
정상적으로 나오게 하려면 어떻게 해야 하나요?
소스는
상단은
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 40;
$img_height = 30;
$img_quality = 99;
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path."/thumb_ch01";
$ym = date("ym", $g4[server_time]);
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
썸네일 출력 부분 소스는
<?
//썸네일 생성
$thumfile = "";
$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], 0606);
} else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
$edit_img = $list[$i]['wr_content'];
///////////////////////////// 변경된 부분
if (eregi("data/geditor/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // geditor 사용할 경우주석풀어서 사용
// if (eregi("data/cheditor/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // chedito 사용할 경우주석풀어서 사용
// if (eregi("data/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // 에디터가 cheditor4 이면 주석풀어서 사용
$file = './' . $tmp[0]; // 파일경로 필요에 따라 변경하세요 . or ..
$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], 0606);
}
}
}
if (file_exists($thumb))
$thumfile = "<img src='$thumb' width='{$img_width}' height='{$img_height}' border='0' style='border:0 #eee solid' onmouseover=this.style.filter='alpha(opacity=80)' onmouseout=this.style.filter=''></a>";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width}' height='{$img_height}' style='border:0 #E7E7E7 solid'></a>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?><a href='<?=$list[$i][href]?>'><?=$thumfile?></a>
불량감자님의 스킨에 사용된 썸네일 부분 소스입니다
어느부분이 잘못된것인지 알려주세요 ㅠㅠ
댓글 전체
테스트하면서 이전 썸네일이 갱신이 안된듯합니다.
/data/file/$bo_table/thumb_ch [thumb_ch]<- 이 디랙을 통째로 지우시고 다시 해보세요
스킨에서 썸네일을 만들때 스킨디랙토리를 생성합니다.
그누 기본썸네일 위치는 $g4[path]."/data/file/$bo_table/thumb
이지만 최신글 스킨 및 일반스킨에서 이미지크기때문에 중복시키지 않으려고 새로운
썸디랙을 생성합니다.
글 수정,삭제시에는 기본썸네일 디랙토리만 삭제되므로
스킨에서 별도의 디랙을 만들경우는
아래 3개의 파일을 수정하시면 됩니다.
/bbs/delete.php
/bbs/delete_all.php
/bbs/write_update.php
아래부분을 찾아서
$sql2 = " select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' ";
$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
======== 이걸로 교체하세요
// 업로드된 파일이 있다면 파일 및 썸네일삭제 // 자신이 쓰는에디터가 없으면 밑에 한줄 추가해서 사용
$sql2 = " select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' ";
$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
@unlink("$g4[path]/data/file/$bo_table/$row2[bf_file]"); // 원본삭제
@unlink("$g4[path]/data/file/$bo_table/thumb/$write[wr_id]"); //그누기본 썸네일 삭제
@unlink("$g4[path]/data/file/$bo_table/thumb_ch/$write[wr_id]"); // 썸네일 삭제
@unlink("$g4[path]/data/file/$bo_table/thumb_ch01/$write[wr_id]"); // 썸네일 삭제
@unlink("$g4[path]/data/file/$bo_table/img/$write[wr_id]"); // 신규썸디랙을 계속추가시키세요
이 파일에는 말씀하신 소스가 없어요 ㅠㅠ
참고로 배추빌더 사용중이구여 ~
if ($_POST[bf_file_del][$i])
{
$upload[$i][del_check] = true;
$row = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
@unlink("$g4[path]/data/file/$bo_table/$row2[bf_file]");
이부분을 찾아보세요 요아래에 중복안되게 붙여주세요
if ($_POST[bf_file_del][$i])
{
$upload[$i][del_check] = true;
$row = sql_fetch(" select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
@unlink("$g4[path]/data/file/$bo_table/$row[bf_file]");
@unlink("$g4[path]/data/file/$bo_table/thumb/$write[wr_id]"); //그누기본 썸네일 삭제
@unlink("$g4[path]/data/file/$bo_table/thumb_ch/$write[wr_id]"); // 썸네일 삭제
@unlink("$g4[path]/data/file/$bo_table/thumb_ch01/$write[wr_id]"); // 썸네일 삭제
@unlink("$g4[path]/data/file/$bo_table/img/$write[wr_id]"); // 신규썸디랙을 계속추가시키세요
이렇게 말씀하신대로 다 수정했는데.. 변화가 없네요
계속 이미지가 내용과 맞지 않게 나오는데~ 바로 나타나지 않는건가요?
아니면 젤위에 $thumb_path = $data_path."/thumb_ch01";
이부분을 변경하여 각페이지 게시판마다 따로 스킨을 적용해야 하나요ㅠㅠ
이후에 편하게 관리 할 수 있도록..
------------------------------------------------------------
그리고 질문하신 문제의 해결방법은 위에도 설명되어 있듯이
/data/file/$bo_table/thumb_ch <- 썸네일 디랙토리 전체를 삭제시키세요
/data/file/$bo_table/ 여기 밑에 있는 썸네일 폴더들을 전부 삭제!!
llst.skin.php 에서 다시 만들어 주니까 염려하지 마시고 삭제하세요.
그리고 다시 리스트페이지를 열어보세요.
전체 게시판 데이터폴더에 썸네일파일/폴더 다 삭제 해봤는데도 안되서 ^^;
소스부분에 문제가 있는건가해서 질문을 ㅠㅠ
http://www.styledb.com/?mw_main=G04
요기보시면 이야기방, 포토존, 게임/동영상 메뉴에 적용을 시켰는데
썸네일이 중복되어 나오는 부분이 ㅡㅜ
수정되신건가요? 아니면 페이지를 콕~! 찍어서 알려주세요
http://www.styledb.com/?mw_main=G02&mw_menu=49
요기랑
http://www.styledb.com/?mw_main=G02&mw_menu=91
요기에 보셔도 내용과 맞지않는 썸네일과 두개가 다른 게시판인데 동일한 썸네일이 나와요 ㅠㅠ
1. $bo_table 이 빠져있습니다.
---------------------------------------
<a href='./bbs/board.php?bo_table=accessories&wr_id=98'><img src='./data/file//thumb_ch01/98'
<a href='./bbs/board.php?bo_table=star_style&wr_id=245'><img src='./data/file//thumb_ch01/245'
2. 에디터사용하면 썸네일 엉킬수도 있습니다.
엉키지 않게 하려면 파일첨부로만 이미지등록하셔야 합니다.
아니면 소스하단을 아래와 같이 바꿔 넣으세요
///////////////////////////////////////////////////////////////////
//////// data/##editor/ 불러오던 원본값을 썸디렉에서 가져오게 변경
////////////////////////////////////////////////////////////////////
<? for ($i=0; $i<count($list); $i++) {
$thumb = $thumb_path.'/'.$list[$i][wr_id];
if (file_exists($thumb))
$thumfile = "$thumb";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width_s}' height='{$img_height_s}' style='border:0 #E7E7E7 solid'></a>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }