테스트 사이트 - 개발 중인 베타 버전입니다

최신글 썸네일 출력 도와주세요.

· 15년 전 · 1486 · 1
최신글로 아래 소스를 쓰고있습니다.

에디터로 작성한 글의 이미지도 썸네일로 불러오고 싶은데

에디터 본문의 이미지는 없는 것으로 인식합니다.

어떻게 하면 될까요?

$dest_file = "data/$g4[geditor]/".date("ym")."/";

에디터 이미지는 위와 같이 저장이 됩니다.


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

// 썸네일방식은 유창화님의 소스.

include_once "$g4[path]/lib/image_proc.function.php";

//경로 변수 설정
$path_data = $g4['path'] . '/data/file/' . $bo_table;
$path_data_thumb = $path_data . '/thumb';

//디렉토리 생성 여부 확인 및 생성, 퍼미션 조정
if (!is_dir($path_data_thumb)){

@mkdir($path_data_thumb, 0707);
@chmod($path_data_thumb, 0707);
}

$thumb_print_num = $thumb_lines;//썸네일 출력 갯수
$thumb_save_w = 105; // 썸네일 넓이
$thumb_save_h = 70; // 썸네일 높이

$letters1 = '120'; // 그림있을 경우 글자수(아래처럼 적당한 숫자가능)
$letters2 = '180'; // 그림없을 경우 글자수
?>

<STYLE>P.BigFirst:first-letter { color:red; font-size: 200%; float: left; padding:7 7 7 3; }</STYLE>

<table width=100% cellpadding=0 cellspacing=3 style="border:1 solid #FFCC00;">
<tr>
<td width=2></td>
<td bgcolor="#A7CE31" width="10"></td>
<td height=17 valign="bottom">&nbsp;&nbsp;
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>' style="font-size:13px;text-decoration:none;"><b><?=$board[bo_subject]?></b></a>
</td>
</tr>
</table>
<table width=100% border='0' cellspacing='0' cellpadding='0'>
<?
$list_cnt = count($list);
for ($i = 0; $i < $list_cnt; $i++){

if($i >= 0 && $i < $thumb_print_num) {//처음부터 $thumb_print_num 까지 썸네일 출력

if ($i > 0) { echo "<tr><td height=1 background='$g4[path]/img/dot_line.gif'></td></tr>"; }

$wr_content = preg_replace("/<(.*?)\>/", ' ', $list[$i]['wr_content']);
$wr_content = preg_replace("/&nbsp;/", ' ', $wr_content);
$wr_content = str_replace("//##", ' ', $wr_content);

$path_save_file = '';
$name_src_file = $list[$i]['file'][0]['file']; //첫번째 이미지 파일로 지정

if (preg_match("/\.(gif|jpe?g|png)$/i", $name_src_file)){

$thumb_options['crop_use'] = 1;

if ($options ==1){ $thumb_save_h = 0;} //너비 기준 정비율 리사이즈

if ($options ==2){ $thumb_save_w = 0;} //높이 기준 정비율 리사이즈

if ($options ==3){//너비 기준은 가운데, 높이 기준은 상단으로 크롭

$thumb_options['crop_pos_width'] = 2; // 1 좌, 2 가운데, 3 우
$thumb_options['crop_pos_height'] = 1; // 1 상, 2 중, 3 하
}

if ($options ==4){//너비 기준은 가운데, 높이 기준은 중앙으로 크롭

$thumb_options['crop_pos_width'] = 2; // 1 좌, 2 가운데, 3 우
$thumb_options['crop_pos_height'] = 2; // 1 상, 2 중, 3 하
}


$path_src_file = $path_data . '/' . $name_src_file;//원본파일
$path_save_file = $path_data_thumb . '/' . $thumb_save_w . 'X' . $thumb_save_h . '_' . $options . '_' . $name_src_file;//썸네일 파일

if (!file_exists($path_save_file)) {

$result = thumnail_test1($path_src_file, $path_save_file, $thumb_save_w, $thumb_save_h, $thumb_options);

}
}


$wr_content = preg_replace("/<(.*?)\>/"," ",$list[$i][wr_content]);
$wr_content = preg_replace("/&nbsp;/"," ",$wr_content);
$wr_content = str_replace("//##", " ", $wr_content);
$wr_content1 = cut_str(get_text($wr_content), $letters1, '…');
$wr_content2 = cut_str(get_text($wr_content), $letters2, '…');//본문 글 줄이는 함수
$href = $list[$i]['href'];
$num = $list[$i][num];

if (file_exists($path_save_file)) {

echo "<tr><td style='padding:5;'>";
echo "<span style='float:left' style='padding:5 5 0 5;'>
<a href='{$list[$i][href]}'><img src='$path_save_file' border=0></a></span>
&nbsp;<img src='{$latest_skin_path}/img/icon_li.gif' border='0' align='absmiddle'>&nbsp;
<a href='{$list[$i][href]}' style='text-decoration:none;'><b>{$list[$i][subject]}</b></a>";

if ($list[$i]['comment_cnt']) {
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8px; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
}

echo "<br><div align='justify' style='margin-right:1; margin-left:1;'><a href='{$list[$i][href]}' style='line-height:130%;text-decoration:none;'>$wr_content1</a>&nbsp;<span style='font-family:돋움;color:#9A9A9A;'>{$list[$i][datetime2]}</span></div>";
echo "</td></tr>";
}
else {
echo "<tr><td style='padding:5 0 0 5;'>";
echo "&nbsp; <img src='{$latest_skin_path}/img/icon_li.gif' border='0' align='absmiddle'>&nbsp;<a href='{$list[$i][href]}' style='text-decoration:none;'><b>{$list[$i][subject]}</b></a>";

if ($list[$i]['comment_cnt']) {
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
}

echo "</td></tr>";
echo "<tr><td style='padding:0 5 5 5;'>";
echo "<div align='justify' style='margin-right:1; margin-left:1;'><P class='BigFirst'><a href='{$list[$i][href]}' style='line-height:130%;text-decoration:none;'>$wr_content2</a>&nbsp;<span style='font-family:돋움;color:#9A9A9A;'>{$list[$i][datetime2]}</span></P></div>";

/* echo "<div align='justify' style='margin-right:1; margin-left:1;'><a href='{$list[$i][href]}' style='font-size:10px; line-height:170%; text-decoration:none;'>$wr_content2</a>&nbsp;{$list[$i][datetime2]}</div>";
*/
echo "</td></tr>";
}
}
else {
if ($i == $thumb_print_num) { echo "<tr><td height=1 background='$g4[path]/img/dot_line.gif'></td></tr>"; }
echo "<tr><td height='20' align='left'>";
echo "&nbsp; <img src='{$latest_skin_path}/img/icon_li.gif' border='0' align='absmiddle'> <a href='{$list[$i][href]}' style=';text-decoration:none;'>{$list[$i][subject]}</a>&nbsp;&nbsp;<span style='font-family:돋움;color:#9A9A9A;'>{$list[$i][datetime2]}</span>";

if ($list[$i]['comment_cnt']) {
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
}
echo "</td></tr>";
}
}
?>
</table>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 1개

에디터에서 작성한 파일은 그누보드와 별도로 저장이 되서 그럴겁니다
다시 말해
$name_src_file = $list[$i]['file'][0]['file']; //첫번째 이미지 파일로 지정
이 것이 잘못&#46124;다는 거지요,,

우선사용하는 에디터에서 작성을 하면 어떤경로에 어떤 이름으로 저장되는지 파악을 하셔서
경로를 바로 잡아 주셔야 할것 같습니다

게시글 목록

번호 제목
284508
284499
284492
284490
284484
284481
284478
284476
284474
284472
284470
284458
284457
284454
284453
284447
284446
284444
284441
284440