에디터 이미지 최신글 출력 문제 정보
에디터 이미지 최신글 출력 문제
본문
에디터(체디터)로 첨부한 이미지는 최신글로 안나오는 문제가 있어서
공유해주신 스킨 소스들을 대입해봤는데 꼭 한가지씩 에러가 발생합니다.
삽입위치를 잘못잡은건지..수정이 필요한 곳을 지나친건지... 도저히 모르겠어요
현기증 나서 잠시 쉴겸 질문 올립니다.
부탁드려요
---------------------------------------------------------------------------------------
<? for ($i=0; $i<count($list); $i++) { ?>
<td valign='top' align='center'>
<?
echo "<a href='{$list[$i]['href']}' target='_top'>";
$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
$img = thumbnail($g4[path] . "/data/file/" . $board[bo_table] . "/". $image, 120, 100, 0, 1, 90);
echo "<img src='$img' style='border:0; vertical-align:bottom;'></a>";
} else
echo "<img src='$latest_skin_path/img/noimage.gif' width='120' height='100' style='border:0; vertical-align:bottom;'></a>";
?></td>
<?} ?>
--------------------------------------------------------------------------------------
공유해주신 스킨 소스들을 대입해봤는데 꼭 한가지씩 에러가 발생합니다.
삽입위치를 잘못잡은건지..수정이 필요한 곳을 지나친건지... 도저히 모르겠어요
현기증 나서 잠시 쉴겸 질문 올립니다.
부탁드려요
---------------------------------------------------------------------------------------
<? for ($i=0; $i<count($list); $i++) { ?>
<td valign='top' align='center'>
<?
echo "<a href='{$list[$i]['href']}' target='_top'>";
$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
$img = thumbnail($g4[path] . "/data/file/" . $board[bo_table] . "/". $image, 120, 100, 0, 1, 90);
echo "<img src='$img' style='border:0; vertical-align:bottom;'></a>";
} else
echo "<img src='$latest_skin_path/img/noimage.gif' width='120' height='100' style='border:0; vertical-align:bottom;'></a>";
?></td>
<?} ?>
--------------------------------------------------------------------------------------
댓글 전체
무슨 에러가 난다는 겁니까?
에디터 이미지 나오는 부분은 없네요?
안된다는 자신이 추가한 코드 부분을 올려야 수정을 해드리죠
에디터 이미지 나오는 부분은 없네요?
안된다는 자신이 추가한 코드 부분을 올려야 수정을 해드리죠

팁자료실과 질문답변에 올라온 소스들이 다양해서 그중에 딱 한가지만 올리기 뭐해서 원본으로 올려봤었어요 아래는 제가 적용한 소스입니다.
출처 팁자료실 ---------------------------------------------------------
<? for ($i=0; $i<count($list); $i++) { ?>
<td valign='top' align='center'>
<?
echo "<a href='{$list[$i]['href']}' target='_top'>";
$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/.(gif|jpg|png)$/i", $image)) {
$img = thumbnail($g4[path] . "/data/file/" . $board[bo_table] . "/". $image, 120, 100, 0, 1, 90);
echo "<img src='$img' style='border:0; vertical-align:bottom;'></a>";
} else
echo "<img src='$latest_skin_path/img/noimage.gif' width='120' height='100' style='border:0; vertical-align:bottom;'></a>";
list($list[$i][img]) = amina_attach_img($list[$i][file], $list[$i][wr_content], 1);
if(!$list[$i][img]) $list[$i][img] = $board_skin_path."/img/noimage.gif";
$list[$i][img] = thumbnail($list[$i][img],$img_width,$img_height,false,1,90); //불당썸
?>
--------------------------------------------------------
발생오류
Deprecated: Function eregi() is deprecated in /home/hosting_users/powergar1/www/extend/amina_attach_img.php on line 24
해당 파일 소스
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 첨부된 이미지 주소 불러오기..
function amina_attach_img($attach, $wr_content, $rows='1') {
global $g4;
$i = 0;
for ($k=0; $k<count($attach); $k++) { //직접 첨부한 이미지
if ($attach[$k][view]) {
$attach_img[$k] = $attach[$k][path]."/".$attach[$k][file];
if(preg_match("/\.(jp[e]?g|gif|png)$/i", $attach_img[$k]) && file_exists($attach_img[$k])) {
$img[$i] = $attach_img[$i];
$i++;
if($i == $rows) break;
}
}
}
if($i != $rows) { //에디터에 삽입된 이미지
$ym = 'data/cheditor4/[^<>]*/[^<>]*\.(gif|jpg|png)';
if(preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $wr_content, $match)) {
for ($k=0; $k<count($match[0]); $k++) {
if(eregi($ym, $match[0][$k], $tmp_img)) {
$chk_img[$i] = $g4[path]."/".$tmp_img[0];
if(file_exists($chk_img[$i])) $img[$i] = $chk_img[$i];
$i++;
if($i == $rows) break;
}
}
}
}
return $img;
}
?>
출처 팁자료실 ---------------------------------------------------------
<? for ($i=0; $i<count($list); $i++) { ?>
<td valign='top' align='center'>
<?
echo "<a href='{$list[$i]['href']}' target='_top'>";
$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/.(gif|jpg|png)$/i", $image)) {
$img = thumbnail($g4[path] . "/data/file/" . $board[bo_table] . "/". $image, 120, 100, 0, 1, 90);
echo "<img src='$img' style='border:0; vertical-align:bottom;'></a>";
} else
echo "<img src='$latest_skin_path/img/noimage.gif' width='120' height='100' style='border:0; vertical-align:bottom;'></a>";
list($list[$i][img]) = amina_attach_img($list[$i][file], $list[$i][wr_content], 1);
if(!$list[$i][img]) $list[$i][img] = $board_skin_path."/img/noimage.gif";
$list[$i][img] = thumbnail($list[$i][img],$img_width,$img_height,false,1,90); //불당썸
?>
--------------------------------------------------------
발생오류
Deprecated: Function eregi() is deprecated in /home/hosting_users/powergar1/www/extend/amina_attach_img.php on line 24
해당 파일 소스
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 첨부된 이미지 주소 불러오기..
function amina_attach_img($attach, $wr_content, $rows='1') {
global $g4;
$i = 0;
for ($k=0; $k<count($attach); $k++) { //직접 첨부한 이미지
if ($attach[$k][view]) {
$attach_img[$k] = $attach[$k][path]."/".$attach[$k][file];
if(preg_match("/\.(jp[e]?g|gif|png)$/i", $attach_img[$k]) && file_exists($attach_img[$k])) {
$img[$i] = $attach_img[$i];
$i++;
if($i == $rows) break;
}
}
}
if($i != $rows) { //에디터에 삽입된 이미지
$ym = 'data/cheditor4/[^<>]*/[^<>]*\.(gif|jpg|png)';
if(preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $wr_content, $match)) {
for ($k=0; $k<count($match[0]); $k++) {
if(eregi($ym, $match[0][$k], $tmp_img)) {
$chk_img[$i] = $g4[path]."/".$tmp_img[0];
if(file_exists($chk_img[$i])) $img[$i] = $chk_img[$i];
$i++;
if($i == $rows) break;
}
}
}
}
return $img;
}
?>
Deprecated 라고 오류 내용이 있네요.
eregi는 더 이상 사용하지않는 함수라는 것입니다
사용중인 서버가 최신버젼이라는 말이 되겠죠
어쨌던 자료실 여러버젼 중에서 ereg, eregi 를 사용하지않는 것을 골라서 사용하세요
eregi는 더 이상 사용하지않는 함수라는 것입니다
사용중인 서버가 최신버젼이라는 말이 되겠죠
어쨌던 자료실 여러버젼 중에서 ereg, eregi 를 사용하지않는 것을 골라서 사용하세요

네 감사합니다 균이님은 참 좋으신분 같아요