에디터로 올린 이미지를 먼저 썸네일로 노출하는 방법
본문
그누보드 5.4버전 사용 중입니다.
첨부파일과 에디터에서 동시에 이미지를 올렸을때 에디터 이미지를 먼저 썸네일로 노출하고, 에디터 이미지 없을 때 첨부파일 이미지를 노출하고 싶은데요.
단순하게
if(isset($row['bf_file']) && $row['bf_file']) {
$filename = $row['bf_file'];
$filepath = G5_DATA_PATH.'/file/'.$bo_table;
$alt = get_text($row['bf_content']);
} else {
$write = get_thumbnail_find_cache($bo_table, $wr_id, 'content');
$edt = true;
if( $matches = get_editor_image($write['wr_content'], false) ){
for($i=0; $i<count($matches[1]); $i++)
{
// 이미지 path 구함
$p = parse_url($matches[1][$i]);
if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
$data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
else
$data_path = $p['path'];
$srcfile = G5_PATH.$data_path;
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
$size = @getimagesize($srcfile);
if(empty($size))
continue;
$filename = basename($srcfile);
$filepath = dirname($srcfile);
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
$alt = isset($malt[1]) ? get_text($malt[1]) : '';
break;
}
$filename = run_replace('get_editor_filename', $filename, $p);
} //end for
} //end if
}
이부분을 뒤집으니 에디터 이미지는 썸네일로잘 나오는데 첨부파일 이미지가 모두 노 이미지로 뜨네요.
다른글 찾아봤는데 조금씩 틀려서 다시 질문 드려 봅니다.
감사합니다.
그리고 여기서 특정한 게시판만 이부분을 적용 할 수 있을까요?
if ($bo_table != 'free') {
}
구문을 정확하게 몰라서 잘 적용이 안되네요...
!-->답변 1
가장 앞단. 1 레벨 if, else 순서가 바뀐것 아닌가요?
첨부 이미지를 먼저 찾는것 같고 ($row['bf_file'])
그 다음에 에디터 이미지를 찾는것 같습니다. (get_editor_image)
답변을 작성하시기 전에 로그인 해주세요.