수정한 스킨입니다. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

수정한 스킨입니다. 정보

답변 수정한 스킨입니다.

첨부파일

gga_gallery_thum_ed.zip (38.0K) 21회 다운로드 2005-07-20 22:19:50

본문

원하시는대로 되었는지는 잘 모르겠지만
암튼 썸네일이 나옵니다.
짜집기의 산물... ^^;;
  • 복사

댓글 전체

return <<<HEREDOC 에서 HEREDOC 뒤에 모든 공백 및 탭을 제거하시고
HEREDOC; 이전의 공백 및 탭 그리고 ;이후의 공백 및 탭을 제거하고 다시 테스트해보세요
if ($thum != "") return <<<HEREDOC <img src="$thum" width="$thum_W" height="$thum_H" onclick="this.src='$file';this.tmp_width=$width;this.tmp_height=$height;image_window(this);" style="cursor:pointer;" title="$content" alt="$content"> HEREDOC;
    else
      return "";

위처럼 한 칸 띄어야 할 부분을 빼곤 두칸 띤 부분이나 그런건 없애줬습니다만.. 여전하네요..
<?

if($board[bo_4]) {
$smark = substr($board[bo_4],0,1); // 제목의 구분자를 파악한다.
$itemtitle = explode("$smark", $board[bo_4]); // 제목 구분자로 제목을 나눈다.

}

$noIMG = $board_skin_path."/img/_noIMG.gif"; //[필수](URL)
$max = $itemtitle[1] ; //[필수](픽셀) // 썸네일 이미지의 가로세로(긴쪽)의 최대치.
$resol = $itemtitle[2] ; //[필수](퍼센트%) // 생성되는 썸네일의 JPG압축률.
$str = $itemtitle[3] ; //[필수](글자수) // 썸네일 밑의 제목의 글자수.

####################################################################################################################################################

function smaller( $W, $H ) {
global $max, $thum_W, $thum_H ;

if ( $W > $H ) { //가로형일 경우.
$thum_W = $max ;
$thum_H = ceil( $H * ( $max / $W ) );
}
if ( $W < $H ) { //세로형일 경우.
$thum_H = $max ;
$thum_W = ceil( $W * ( $max / $H ) );
}
if ( $W == $H ) { //정사각형일 경우.
$thum_W = ceil( $max * 0.8 );
$thum_H = ceil( $max * 0.8 );
}

return $thum_W ;
return $thum_H ;
}


function maker( $thum_W, $thum_H ) {
global $thum, $resol, $ori, $ori_info ;

//$newImg = ImageCreate($thum_W,$thum_H); // GD라이브러리 2.0 (이하일 경우)
$newImg = ImageCreateTrueColor($thum_W,$thum_H); // GD라이브러리 2.0 전용함수

if($ori_info[2]=="2") $origImg=ImageCreateFromjpeg($ori);
if($ori_info[2]=="3") $origImg=ImageCreateFrompng($ori);

//ImageCopyResized($newImg,$origImg,0,0,0,0,$thum_W,$thum_H,ImageSX($origImg),ImageSY($origImg));
imageCopyResampled($newImg,$origImg,0,0,0,0,$thum_W,$thum_H,ImageSX($origImg),ImageSY($origImg));

Imagejpeg($newImg, $thum, $resol );

chmod($thum,0707);
ImageDestroy($newImg);
ImageDestroy($origImg);

return $thum ;
}


// view_file_link2() 함수에서 넘겨진 이미지를 보이게 합니다.
// {썸네일:0} ... {썸네일:n} 과 같은 형식
function view_thumb($view, $number, $attribute)
{
if ($view[file][$number][view2])
return preg_replace("/>$/", " $attribute>", $view[file][$number][view2]);
else
//return "{".$number."번 이미지 없음}";
return "";
}


function view_file_link2($file, $width, $height, $content='') // 원본대신 썸네일을 보여줍니다.
{
  global $config, $board;
  global $g4;

  if (!$file) return;

  $enc_file = "{$g4['path']}/data/file/{$board['bo_table']}/" . urlencode($file);
  $file = "{$g4['path']}/data/file/{$board['bo_table']}/$file";

  if (preg_match("/\.({$config['cf_image_extension']})$/i", $file)) {
    $ori_info=getimagesize($file);
   
    if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) {
      $thum = $file.".Thum" ;
      $thum_info = getimagesize ($thum);
      $thum_W = $thum_info[0] ;
      $thum_H = $thum_info[1] ;
      $thum = $enc_file . ".Thum";
    } elseif ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) {
      if ( smaller( $ori_info[0], $ori_info[1] ) ) $thum = $enc_file ;
    } else {
      $thum = "";
    }
   
    if ($thum != "")
      return <<<HEREDOC
<img src="$thum" width="$thum_W" height="$thum_H" onclick="this.src='$file';this.tmp_width=$width;this.tmp_height=$height;image_window(this);" style="cursor:pointer;" title="$content" alt="$content">
HEREDOC;
    else
      return "";
  }
}
####################################################################################################################################################
?>

전체 내용입니다.
<?

if($board[bo_4]) {
$smark = substr($board[bo_4],0,1); // 제목의 구분자를 파악한다.
$itemtitle = explode("$smark", $board[bo_4]); // 제목 구분자로 제목을 나눈다.

}

$noIMG = $board_skin_path."/img/_noIMG.gif"; //[필수](URL)
$max = $itemtitle[1] ; //[필수](픽셀) // 썸네일 이미지의 가로세로(긴쪽)의 최대치.
$resol = $itemtitle[2] ; //[필수](퍼센트%) // 생성되는 썸네일의 JPG압축률.
$str = $itemtitle[3] ; //[필수](글자수) // 썸네일 밑의 제목의 글자수.

####################################################################################################################################################

function smaller( $W, $H ) {
global $max, $thum_W, $thum_H ;

if ( $W > $H ) { //가로형일 경우.
$thum_W = $max ;
$thum_H = ceil( $H * ( $max / $W ) );
}
if ( $W < $H ) { //세로형일 경우.
$thum_H = $max ;
$thum_W = ceil( $W * ( $max / $H ) );
}
if ( $W == $H ) { //정사각형일 경우.
$thum_W = ceil( $max * 0.8 );
$thum_H = ceil( $max * 0.8 );
}

return $thum_W ;
return $thum_H ;
}


function maker( $thum_W, $thum_H ) {
global $thum, $resol, $ori, $ori_info ;

//$newImg = ImageCreate($thum_W,$thum_H); // GD라이브러리 2.0 (이하일 경우)
$newImg = ImageCreateTrueColor($thum_W,$thum_H); // GD라이브러리 2.0 전용함수

if($ori_info[2]=="2") $origImg=ImageCreateFromjpeg($ori);
if($ori_info[2]=="3") $origImg=ImageCreateFrompng($ori);

//ImageCopyResized($newImg,$origImg,0,0,0,0,$thum_W,$thum_H,ImageSX($origImg),ImageSY($origImg));
imageCopyResampled($newImg,$origImg,0,0,0,0,$thum_W,$thum_H,ImageSX($origImg),ImageSY($origImg));

Imagejpeg($newImg, $thum, $resol );

chmod($thum,0707);
ImageDestroy($newImg);
ImageDestroy($origImg);

return $thum ;
}


// view_file_link2() 함수에서 넘겨진 이미지를 보이게 합니다.
// {썸네일:0} ... {썸네일:n} 과 같은 형식
function view_thumb($view, $number, $attribute)
{
if ($view[file][$number][view2])
return preg_replace("/>$/", " $attribute>", $view[file][$number][view2]);
else
//return "{".$number."번 이미지 없음}";
return "";
}


function view_file_link2($file, $width, $height, $content='') // 원본대신 썸네일을 보여줍니다.
{
  global $config, $board;
  global $g4;

  if (!$file) return;

  $enc_file = "{$g4['path']}/data/file/{$board['bo_table']}/" . urlencode($file);
  $file = "{$g4['path']}/data/file/{$board['bo_table']}/$file";

  if (preg_match("/\.({$config['cf_image_extension']})$/i", $file)) {
    $ori_info=getimagesize($file);
   
    if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) {
      $thum = $file.".Thum" ;
      $thum_info = getimagesize ($thum);
      $thum_W = $thum_info[0] ;
      $thum_H = $thum_info[1] ;
      $thum = $enc_file . ".Thum";
    } elseif ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) {
      if ( smaller( $ori_info[0], $ori_info[1] ) ) $thum = $enc_file ;
    } else {
      $thum = "";
    }
   
    if ($thum != "")
      return <<<HEREDOC
<img src="$thum" width="$thum_W" height="$thum_H" onclick="this.src='$file';this.tmp_width=$width;this.tmp_height=$height;image_window(this);" style="cursor:pointer;" title="$content" alt="$content">
HEREDOC;
    else
      return "";
  }
}
####################################################################################################################################################
?>

위에꺼 그대로 복사해서 붙여넣었는데 왜 계속


Parse error: parse error, unexpected T_SL in /home/httpd/html/rang2/skin/board/gga_gallery_thum_ed2/_include.php on line 97


이게 나오는지 모르겠습니다...

g6man님께 죄송해서 제가 포기하고 싶네요....(__)
function view_file_link2($file, $width, $height, $content='') // 원본대신 썸네일을 보여줍니다.
{
  global $config, $board;
  global $g4;

  if (!$file) return;

  $enc_file = "{$g4['path']}/data/file/{$board['bo_table']}/" . urlencode($file);
  $file = "{$g4['path']}/data/file/{$board['bo_table']}/$file";

  if (preg_match("/\.({$config['cf_image_extension']})$/i", $file)) {
    $ori_info=getimagesize($file);
   
    if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) {
      $thum = $file.".Thum" ;
      $thum_info = getimagesize ($thum);
      $thum_W = $thum_info[0] ;
      $thum_H = $thum_info[1] ;
      $thum = $enc_file . ".Thum";
    } elseif ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) {
      if ( smaller( $ori_info[0], $ori_info[1] ) ) $thum = $enc_file ;
    } else {
      $thum = "";
    }
   
    if ($thum != "")
      return <<<HEREDOC          <=== 요기가 97라인..
<img src="$thum" width="$thum_W" height="$thum_H" onclick="this.src='$file';this.tmp_width=$width;this.tmp_height=$height;image_window(this);" style="cursor:pointer;" title="$content" alt="$content">
HEREDOC;
    else
      return "";
  }
}

그래도 에러가.... 야밤에 저때문에 고생 많으시네요.....;;
오타가 있었네요...
$thum = $enc_file . ".Thum"; 입니다.

function view_file_link2($file, $width, $height, $content='') // 원본대신 썸네일을 보여줍니다.
{
  global $config, $board;
  global $g4;

  if (!$file) return;

  $enc_file = "{$g4['path']}/data/file/{$board['bo_table']}/" . urlencode($file);
  $file = "{$g4['path']}/data/file/{$board['bo_table']}/$file";

  if (preg_match("/\.({$config['cf_image_extension']})$/i", $file)) {
    $ori_info=getimagesize($file);
   
    if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) {
      $thum = $file.".Thum" ;
      $thum_info = getimagesize ($thum);
      $thum_W = $thum_info[0] ;
      $thum_H = $thum_info[1] ;
      $thum = $enc_file . ".Thum";
    } elseif ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) {
      if ( smaller( $ori_info[0], $ori_info[1] ) ) $thum = $enc_file ;
    } else {
      $thum = "";
    }
   
    if ($thum != "")
      return <<<HEREDOC
<img src="$thum" width="$thum_W" height="$thum_H" onclick="this.src='$file';this.tmp_width=$width;this.tmp_height=$height;image_window(this);" style="cursor:pointer;" title="$content" alt="$content">
HEREDOC;
    else
      return "";
  }
}

function view_file_link2 ~ ####전까지 바꿔줍니다.
새로운 땜빵입니다. ^^;;

$enc_file = "{$g4['path']}/data/file/{$board['bo_table']}/" . urlencode($file); 하고
$thum = $rnc_file . ".Thum";
$thum = $enc_file ;
3가지가 변했습니다.
Parse error: parse error, unexpected T_SL in /home/httpd/html/rang2/skin/board/gga_gallery_thum_ed2/_include.php on line 97

요런 얘기가 나오는데요??

_include.php 파일에서 function view_file_link2부분만 위에껄로 바꿔주면 되는거죠?


return <<<HEREDOC    :::97라인입니다.
function view_file_link2($file, $width, $height, $content='') // 원본대신 썸네일을 보여줍니다.
{
global $config, $board;
global $g4;

if (!$file) return;

$enc_file = "{$g4['path']}/data/file/{$board['bo_table']}/" . urlencode($file);
$file = "{$g4['path']}/data/file/{$board['bo_table']}/$file";

if (preg_match("/\.({$config['cf_image_extension']})$/i", $file)) {
$ori_info=getimagesize($file);

if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) {
$thum = $file.".Thum" ;
$thum_info = getimagesize ($thum);
$thum_W = $thum_info[0] ;
$thum_H = $thum_info[1] ;
$thum = $rnc_file . ".Thum";
} elseif ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) {
if ( smaller( $ori_info[0], $ori_info[1] ) ) $thum = $enc_file ;
} else {
$thum = "";
}

if ($thum != "")
return <<<HEREDOC
<img src="$thum" width="$thum_W" height="$thum_H" onclick="this.src='$file';this.tmp_width=$width;this.tmp_height=$height;image_window(this);" style="cursor:pointer;" title="$content" alt="$content">
HEREDOC;
else
return "";
}
}
_include.php 파일에서 78번라인의
$file = "{$g4['path']}/data/file/{$board['bo_table']}/" . urlencode($file); 를
$file = "{$g4['path']}/data/file/{$board['bo_table']}/$file"; 또는
$file = "{$g4['path']}/data/file/{$board['bo_table']}/" . str_replace('%25', '%', urlencode($file));로
바꾸고 다시 테스트해보세요...
저는 아예 올리는 파일에서 %를 없애버렸습니다. (원본에 손을대서 좀 추천하기는 그렇네요...)
관심에 감사드립니다...

http://home.rang2.net:11111/rang2/bbs/board.php?bo_table=testgal

위에 오류가 나는데 좀 봐주시겠어요?.. 그리고 썸네일 생성이 안되는것 같습니다...

//
없다는 파일이름에 근접한 파일입니다
1062731775_5d06f789_%B9%AB%C1%A6-2+%BA%B9%BB%E7.jpg

//
그리고 첫번째 글에서 저는 이미지를 5개 올렸습니다.
앗... 알아냈습니다.. 한글파일명이라서 찾을 수 없다고 나오네요... 어떻게 하죠?..^^;;;

//

앗..썸네일은 됩니다..^^;;; 아까는 마우스 오른쪽버튼의 속성에서 이미지 사이즈가 원래랑 같이 나와서 안되는 줄 알았어요..
© SIRSOFT
현재 페이지 제일 처음으로