썸네일이미지 짤림 정보
썸네일이미지 짤림본문
썸네일 이미지가 비율로 축소가 되지않고 그대로 짤려서 출력됩니다.
여기질답에 어떤분이 같은 질문 올리셔서 답변을 참고해봤는데
갤러리게시판스킨에서 해당부분을 참고로 수정하라고 하시더군요..
제가 초보라 어떻게 해보려했지만 능력부족으로 도저히 안되겠어요.
소스를보고 도와주셨으면 고맙겠습니다.
아래는 관련소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 120;
$img_height = 90;
$img_quality = 95;
if (!$img_width) alert("게시판 설정 : 여분 필드 1 에 목록에서 보여질 이미지의 폭을 설정하십시오. (픽셀 단위)");
if (!$img_height) alert("게시판 설정 : 여분 필드 2 에 목록에서 보여질 이미지의 높이를 설정하십시오. (픽셀 단위)");
if (!$img_quality) alert("게시판 설정 : 여분 필드 3 에 목록에서 보여질 이미지의 질(quality)을 비율로 설정하십시오. (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);
// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 5;
//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
// 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요.
// <nobr style='display:block; overflow:hidden; width:000px;'>제목</nobr>
?>
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$board_skin_path/img/noimage.gif' border=0 width='$img_width' height='$img_height' title='이미지 없음' align=left style='margin-right:5px; border:1 solid #CCCCCC; padding:1px;'>";
$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($thumb_path.'/'.$list[$i][wr_id], $dst, $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border='0' style='border:1px solid #CCCCCC; padding:1px;'>";
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>"; }
?>
<?
echo "<a href='{$list[$i][href]}'>";
echo $img;
echo "</a>";
?>
혹시 thumbEngine 이폴더가 관련폴더인가요? 업로드하고 아래소스를 구해봤지만
어디에 어떻게 추가할지 모르겠습니다.
include_once "$g4[path]/thumbEngine/dq_thumb_engine2.php";
$dqEngine['thumb_resize'] = 1;
// 0, 1, 2 사용
// 0: 원본 비율 대칭 리사이즈, 1: 비율유지 안함(찌그러짐), 2: 원본비율 리사이즈 + Center Crop
$img = $list[$i][file][0][file]; //공백으로인한썸네일깨짐방지
//$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
// notice time
$notice_time = $list[$i][wr_10];
$last_time = $notice_time - $current_time ;
(죽어가는놈 한번 살려주십시오-.-)
여기질답에 어떤분이 같은 질문 올리셔서 답변을 참고해봤는데
갤러리게시판스킨에서 해당부분을 참고로 수정하라고 하시더군요..
제가 초보라 어떻게 해보려했지만 능력부족으로 도저히 안되겠어요.
소스를보고 도와주셨으면 고맙겠습니다.
아래는 관련소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 120;
$img_height = 90;
$img_quality = 95;
if (!$img_width) alert("게시판 설정 : 여분 필드 1 에 목록에서 보여질 이미지의 폭을 설정하십시오. (픽셀 단위)");
if (!$img_height) alert("게시판 설정 : 여분 필드 2 에 목록에서 보여질 이미지의 높이를 설정하십시오. (픽셀 단위)");
if (!$img_quality) alert("게시판 설정 : 여분 필드 3 에 목록에서 보여질 이미지의 질(quality)을 비율로 설정하십시오. (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);
// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 5;
//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
// 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요.
// <nobr style='display:block; overflow:hidden; width:000px;'>제목</nobr>
?>
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$board_skin_path/img/noimage.gif' border=0 width='$img_width' height='$img_height' title='이미지 없음' align=left style='margin-right:5px; border:1 solid #CCCCCC; padding:1px;'>";
$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($thumb_path.'/'.$list[$i][wr_id], $dst, $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border='0' style='border:1px solid #CCCCCC; padding:1px;'>";
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>"; }
?>
<?
echo "<a href='{$list[$i][href]}'>";
echo $img;
echo "</a>";
?>
혹시 thumbEngine 이폴더가 관련폴더인가요? 업로드하고 아래소스를 구해봤지만
어디에 어떻게 추가할지 모르겠습니다.
include_once "$g4[path]/thumbEngine/dq_thumb_engine2.php";
$dqEngine['thumb_resize'] = 1;
// 0, 1, 2 사용
// 0: 원본 비율 대칭 리사이즈, 1: 비율유지 안함(찌그러짐), 2: 원본비율 리사이즈 + Center Crop
$img = $list[$i][file][0][file]; //공백으로인한썸네일깨짐방지
//$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
// notice time
$notice_time = $list[$i][wr_10];
$last_time = $notice_time - $current_time ;
(죽어가는놈 한번 살려주십시오-.-)
댓글 전체
nclude_once "$g4[path]/thumbEngine/dq_thumb_engine2.php"; <== 이건 제로보드 dq엔진쪽 아닌가요?
dq_thumb_engine2.php 파일을 가지고 계신 건가요?
dq_thumb_engine2.php 파일을 가지고 계신 건가요?
네 시작님 해당파일은 있습니다. 근데 제로보드쪽인줄은 몰랐습니다.
이게 제로보드dq엔진이면 그누보드에선 안되는건가요??
이게 제로보드dq엔진이면 그누보드에선 안되는건가요??