http://photossik88.cafe24.com/bbs/board.php?bo_table=1010
위 주소의 갤러리 이구요.
자세히 보시면 사진이 가운데에 위치해야하는데 썸네일의 사이즈 보다 조금 커서
왼쪽부터 맞춰집니다.
사진이 썸네일 지정한 크기인 240에 180으로 표시되게 하고싶은데요 강제적으로.
아래 skin.lib.php를 봐도 어딜 건드려야 할지모르겠네요ㅜㅜㅜㅜ
부탁좀드릴게요ㅜ
<?if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!function_exists("makeThumbs")) { function makeThumbs($oriPath, $oriFileName, $thmWidth="", $thmHeight="", $thmAlt="") { global $g4, $board_skin_path; $errorFilePrt = "<img src=\"".$board_skin_path."/img/noimage.gif\" border=\"0\" alt=\"이미지 없음\" />"; $oriFile = $oriPath . "/" . $oriFileName; if (is_file($oriFile) == false) return $errorFilePrt; // 원본 부재 $thmPath = $oriPath . "/thumbs"; $thmFile = $thmPath . "/" . $oriFileName; $oriSize = getimagesize($oriFile); $oriWidth = $oriSize[0]; $oriHeight = $oriSize[1]; $oriType = $oriSize[2]; if ($oriType > 3) return $errorFilePrt; // 원본 이미지 타입 오류 $oriRate = $oriWidth / $oriHeight; if ($thmWidth == "" && $thmHeight == "") return $errorFilePrt; // 썸네일 사이즈 미지정 if ($thmWidth == "") $thmWidth = $thmHeight * $oriRate; if ($thmHeight == "") $thmHeight = $thmWidth / $oriRate; $widthRate = $thmWidth / $oriWidth; $heightRate = $thmHeight / $oriHeight; $oriFilePrt = "<img src=\"".$oriFile."\" width=\"".$oriWidth."\" height=\"".$oriHeight."\" border=\"0\" alt=\"".$thmAlt."\" />"; if ($widthRate >= 1 && $heightRate >= 1) return $oriFilePrt; // 리사이징 불필요 if (file_exists($thmFile)) { // 썸네일 유무 $fp = fopen($thmFile, "r"); $fstat = fstat($fp); $thmFileTime = $fstat['ctime']; fclose($fp); $fp = fopen($oriFile, "r"); $fstat = fstat($fp); $oriFileTime = $fstat['ctime']; fclose($fp); if (is_dir($oriPath . "/thumbs/")) { $array1 = $array2 = array(); if ($dh = opendir($oriPath . "/thumbs/")) { while (($file = readdir($dh)) !== false) { $array1[] = $file; } closedir($dh); } if ($dh = opendir($oriPath . "/")) { while (($file = readdir($dh)) !== false) { $array2[] = $file; } closedir($dh); } $array_diff = array_diff($array1, $array2); foreach ($array_diff as $k => $v) { if (is_file($oriPath . "/thumbs/" . $v)) @unlink($oriPath . "/thumbs/" . $v); } } $thmFileSize = getimagesize($thmFile); if ($thmWidth == $thmFileSize[0] && $thmHeight == $thmFileSize[1]) { // 썸네일 갱신 불필요 if ($thmFileTime > $oriFileTime) { $thmSize = getimagesize($thmFile); $thmFilePrt = "<img src=\"".$thmFile."\" width=\"".$thmSize[0]."\" height=\"".$thmSize[1]."\" border=\"0\" alt=\"".$thmAlt."\" />"; return $thmFilePrt; } } } @unlink($thmFile); @mkdir($thmPath); @chmod($thmPath, 0707); if ($widthRate < $heightRate) { $tempWidth = (int)($oriWidth * $heightRate); $tempHeight = $thmHeight; } else { $tempWidth = $thmWidth; $tempHeight = (int)($oriHeight * $widthRate); } if ($tempWidth == "") $tempWidth = $thmWidth; if ($tempHeight == "") $tempHeight = $thmHeight; switch($oriType) { case(1) : if(function_exists('imagecreateFromGif')) $tempImage = imagecreateFromGif($oriFile); break; case(2) : if(function_exists('imagecreateFromJpeg')) $tempImage = imagecreateFromJpeg($oriFile); break; case(3) : if(function_exists('imagecreateFromPng')) $tempImage = imagecreateFromPng($oriFile); break; } if ($tempImage) { if (function_exists('imagecreatetruecolor')) { $tempCanvas = imagecreatetruecolor($thmWidth, $thmHeight); } else { $tempCanvas = imagecreate($thmWidth, $thmHeight); } if (function_exists('imagecopyresampled')) { imagecopyresampled($tempCanvas, $tempImage, 0, 0, 0, 0, $tempWidth, $tempHeight, ImageSX($tempImage), ImageSY($tempImage)); } else { imagecopyresized($tempCanvas, $tempImage, 0, 0, 0, 0, $tempWidth, $tempHeight, ImageSX($tempImage), ImageSY($tempImage)); } ImageDestroy($tempImage); ImageJpeg($tempCanvas, $thmFile, 100); ImageDestroy($tempCanvas); unset($tempImage, $tempCanvas); } $thmFilePrt = "<img src=\"{$thmFile}\" width=\"{$thmWidth}\" height=\"{$thmHeight}\" border=\"0\" alt=\"{$thmAlt}\" />"; return $thmFilePrt; }}?>
답변 6개
위의 소스 86 - 92줄 까지를 아래와 같이 변경
$srcX = 0; $srcY = 0; if ($widthRate < $heightRate) { $tempWidth = (int)($oriWidth * $heightRate); $tempHeight = $thmHeight; $srcX = ceil(($tempWidth - $thmWidth)/($tempWidth/$oriWidth)/2); } else { $tempWidth = $thmWidth; $tempHeight = (int)($oriHeight * $widthRate); $srcY = ceil(($tempHeight - $thmHeight)/($tempHeight/$oriHeight)/2); }
위의 소스 116-120줄을 아래와 같이 변경
if (function_exists('imagecopyresampled')) { imagecopyresampled($tempCanvas, $tempImage, 0, 0, $srcX, $srcY, $tempWidth, $tempHeight, ImageSX($tempImage), ImageSY($tempImage)); } else { imagecopyresized($tempCanvas, $tempImage, 0, 0, $srcX, $srcY, $tempWidth, $tempHeight, ImageSX($tempImage), ImageSY($tempImage)); }
아마 기존 썸네일을 지우셔야 갱신되지 싶은데 함 해보세요.
요걸로 되야될건데...
list.skin.php에서
가로세로 링크에서 섬네일링크를 업로드 링크로 변경처리도 해주세요
그래야 더 맑은 이미지를 걸수 있습니다.
기다려 봐요 테스트 좀 해보구요.
테이블 1010 이 쓰는 스킨디렉토리에서 list.skin.php 에 가로 세로 넓이가 픽스되어있나 확인해보세요.
7번라인
global $g4, $board_skin_path; 아래
$thmWidth="240"; 넣어주면 됩니다.
답변을 작성하려면 로그인이 필요합니다.