cheditor로 업한 이미지를 리스트에 나오게 하려면? 정보
cheditor로 업한 이미지를 리스트에 나오게 하려면?
본문
스킨자료실에 보면 아래처럼 geditor로 업한 이미지도 리스트에 나오게 하는 웹진형 게시판이 있습니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=79204&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%C0%A5%C1%F8&sop=and
그런데 cheditor로 업한 이미지를 나오게 하는 게시판은 없더라구요..
혹시 cheditor로 업한 이미지를 리스트에 나오게 할 수 있는 방법은 없는 걸까요?
있다면 소스를 알고 계신 분께 도움을 좀 받고자 합니다 ^^
많은 관심 부탁드립니다 ^^
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=79204&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%C0%A5%C1%F8&sop=and
그런데 cheditor로 업한 이미지를 나오게 하는 게시판은 없더라구요..
혹시 cheditor로 업한 이미지를 리스트에 나오게 할 수 있는 방법은 없는 걸까요?
있다면 소스를 알고 계신 분께 도움을 좀 받고자 합니다 ^^
많은 관심 부탁드립니다 ^^
댓글 전체
$data_path = $g4[path]."/data/file/$bo_table"; // 그누보드 data 경로
$thumb_path = $data_path.'/thumb';
$pat = "/<img [^<>]*src\=[(\"|')]{0,1}([^(\"|')>]*)/i";
preg_match_all($pat, $list[$i][wr_content], $matches);
$image_url = preg_replace("/([^(http:\/\/)]|\(|^)([^[:space:]]+)\/data/", "", $matches[1][0]);
$img = "";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
$img_path = $g4[path]."/data/file/".$bo_table."/thumb/".$list[$i][wr_id];
if (!file_exists($thumb))
{
//$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
$file = $g4[path]. "/data". $image_url; //
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
continue;
$rate = $board[bo_1] / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $board[bo_2])
$dst = imagecreatetruecolor($board[bo_1], $height);
else
$dst = imagecreatetruecolor($board[bo_1], $board[bo_2]);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_1], $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $board[bo_3]);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
$thumb_path = $data_path.'/thumb';
$pat = "/<img [^<>]*src\=[(\"|')]{0,1}([^(\"|')>]*)/i";
preg_match_all($pat, $list[$i][wr_content], $matches);
$image_url = preg_replace("/([^(http:\/\/)]|\(|^)([^[:space:]]+)\/data/", "", $matches[1][0]);
$img = "";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
$img_path = $g4[path]."/data/file/".$bo_table."/thumb/".$list[$i][wr_id];
if (!file_exists($thumb))
{
//$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
$file = $g4[path]. "/data". $image_url; //
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
continue;
$rate = $board[bo_1] / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $board[bo_2])
$dst = imagecreatetruecolor($board[bo_1], $height);
else
$dst = imagecreatetruecolor($board[bo_1], $board[bo_2]);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_1], $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $board[bo_3]);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
$pat = "/<img [^<>]*src\=[(\"|')]{0,1}([^(\"|')>]*)/i";
preg_match_all($pat, $list[$i][wr_content], $matches);
$image_url = preg_replace("/([^(http:\/\/)]|\(|^)([^[:space:]]+)\/data/", "", $matches[1][0]);
이 소스가 핵심입니다...
그 아래는 이미지를 이용해 GD 썸네일을 생성하는 소스 입니다..
preg_match_all($pat, $list[$i][wr_content], $matches);
$image_url = preg_replace("/([^(http:\/\/)]|\(|^)([^[:space:]]+)\/data/", "", $matches[1][0]);
이 소스가 핵심입니다...
그 아래는 이미지를 이용해 GD 썸네일을 생성하는 소스 입니다..
June44님 관신가져주셔서 감사합니다 ^^
근데 제 머리가 나빠서 그런지 도통 이해가 안돼네요..ㅎㅎ
그누보드 내의 data 폴더에서 cheditor 부분의 이미지를 뽑아온다는 것 같기도 하고..
그럼 각 게시물에 맞는 이미지를 뽑아와야하고 이미지가 없으면 노이미지도 떠야하고..
또 그걸 뽑아와서 출력하는 부분에서 echo라는 문구를 넣어야 하는지..어떤 함수를 출력해야 하는지.
제 머리가 한계를 드러내네요..^^
조금 더 쉽게 설명 부탁드려도 될까요?
근데 제 머리가 나빠서 그런지 도통 이해가 안돼네요..ㅎㅎ
그누보드 내의 data 폴더에서 cheditor 부분의 이미지를 뽑아온다는 것 같기도 하고..
그럼 각 게시물에 맞는 이미지를 뽑아와야하고 이미지가 없으면 노이미지도 떠야하고..
또 그걸 뽑아와서 출력하는 부분에서 echo라는 문구를 넣어야 하는지..어떤 함수를 출력해야 하는지.
제 머리가 한계를 드러내네요..^^
조금 더 쉽게 설명 부탁드려도 될까요?
$img = ""; <- 이부분에 <img src="xxx/noimage.gif" alt="" /> 등 HTML태그로 Noimage를 표시해 주시면 됩니다.
if (file_exists($thumb))
$img = "<img src='$img_path' border=0 width='$board[bo_1]' height='$board[bo_2]' alt='' />";
저소스 아래에 이런식으로 쓰시면 됩니다..
저 소스를 사용 하실 때는 게시판 설정에 bo_3에는 이미지퀄리티 90~100사이 넣어주시면되구요..
bo_1,bo_2는 가로, 세로 입니다
echo $img; 하시면 이미지 출력됩니다..
소스의 정확한 이해는
글의 내용중에 이미지가 들어가 있으면 src 안의 내용을 뽑아서
해당 주소로 썸네일을 생성하는 것입니다..
if (file_exists($thumb))
$img = "<img src='$img_path' border=0 width='$board[bo_1]' height='$board[bo_2]' alt='' />";
저소스 아래에 이런식으로 쓰시면 됩니다..
저 소스를 사용 하실 때는 게시판 설정에 bo_3에는 이미지퀄리티 90~100사이 넣어주시면되구요..
bo_1,bo_2는 가로, 세로 입니다
echo $img; 하시면 이미지 출력됩니다..
소스의 정확한 이해는
글의 내용중에 이미지가 들어가 있으면 src 안의 내용을 뽑아서
해당 주소로 썸네일을 생성하는 것입니다..
감사합니다 ^^ 이제 조금 이해가 되네요..
출력하는 부분은 echo $img; 로 뽑아내면 되는 것 같구요..
노이미지 부분도 해결이 될 듯 싶습니다 ^^
if (file_exists($thumb))
$img = "<img src='$img_path' border=0 width='$board[bo_1]' height='$board[bo_2]' alt='' />";
이 부분은 이미지가 존재한다면 가로 세로 크기로 이미지를 불러오는 것이군요..
리스트화일에 적용해보고 이것저것 조금 더 공부해봐야겠네요..
제가 너무 몰라서.. 게다가 이해력도 달려서..^^
리스트의 어느 부분에 소스를 어떻게 넣어야하고..
출력하는 부분은 어떻게 완성된 문구를 넣는지를 모르겠습니다..
아~ 이럴때..너무 답답해지네요..ㅎㅎ
출력하는 부분은 echo $img; 로 뽑아내면 되는 것 같구요..
노이미지 부분도 해결이 될 듯 싶습니다 ^^
if (file_exists($thumb))
$img = "<img src='$img_path' border=0 width='$board[bo_1]' height='$board[bo_2]' alt='' />";
이 부분은 이미지가 존재한다면 가로 세로 크기로 이미지를 불러오는 것이군요..
리스트화일에 적용해보고 이것저것 조금 더 공부해봐야겠네요..
제가 너무 몰라서.. 게다가 이해력도 달려서..^^
리스트의 어느 부분에 소스를 어떻게 넣어야하고..
출력하는 부분은 어떻게 완성된 문구를 넣는지를 모르겠습니다..
아~ 이럴때..너무 답답해지네요..ㅎㅎ