짬뽕 스킨-리스트 섬네일(첨부파일) - 채택완료
작은별님의 리스트에 섬네임 1개 나오는 스킨에...
열린이글님의 구찬아 스킨의 첨부파일이 섬네일 2개 나오는 것을
짱뽕하고 있습니다.
적당히 짬뽕이 된거 같은데요 ㅋ
문제는 리스트의 첨부파일 섬네일이 2개 밖에 안나오는데 이거를
5개로 늘리고 싶습니다.
소스가 $thumb = get_list_thumbnail, $thumb = get_list_thumbnail_0 이렇게 2개 있는 것을 ====아래처럼
$thumb = get_list_thumbnail_1, $thumb = get_list_thumbnail_2, $thumb = get_list_thumbnail_3으로 하니 안되네요,,
즉 2번 사진이 3,4,5에 동일하게 나와버리는 현상입니다.
좀 봐주시면 감사하겠습니다.
섬네일 2개 일때
if (!$list[$i]['is_notice']) { $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb['src']) { $img_content = ' } else { $img_content = ' } echo $img_content; $thumb = get_list_thumbnail_0($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb['src']) { $img_content_0 = ' } else { $img_content_0 = ' } echo $img_content_0; $thumb = get_list_thumbnail_1($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); } ?> ';
';';
';
=================================================
섬네일 5개 일때
if (!$list[$i]['is_notice']) { $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb['src']) { $img_content = ' } else { $img_content = ' } echo $img_content; $thumb = get_list_thumbnail_0($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb['src']) { $img_content_0 = ' } else { $img_content_0 = ' } echo $img_content_0; $thumb = get_list_thumbnail_1($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb['src']) { $img_content_1 = ' } else { $img_content_1 = ' } echo $img_content_1; $thumb = get_list_thumbnail_1($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb['src']) { $img_content_2 = ' } else { $img_content_2 = ' } echo $img_content_2; $thumb = get_list_thumbnail_1($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb['src']) { $img_content_3 = ' } else { $img_content_3 = ' } echo $img_content_3; } ?> ';
';';
';';
';';
';';
';
답변 2개
// 게시글리스트 썸네일 생성 function get_list_thumbnail_test($bo_table, $wr_id, $thumb_width, $thumb_height, $is_create=false, $is_crop=true, $crop_mode='center', $is_sharpen=false, $um_value='80/0.5/3', $bf_no = '0') { global $g5, $config; $filename = $alt = ""; $edt = false;
$sql = " select bf_file, bf_content from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '{$bf_no}' order by bf_no limit 0, 1 "; $row = sql_fetch($sql);
if($row['bf_file']) { $filename = $row['bf_file']; $filepath = G5_DATA_PATH.'/file/'.$bo_table; $alt = get_text($row['bf_content']); } else { $write_table = $g5['write_prefix'].$bo_table; $sql = " select wr_content from $write_table where wr_id = '$wr_id' "; $write = sql_fetch($sql); $matches = get_editor_image($write['wr_content'], false); $edt = true;
for($i=0; $i
$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 = get_text($malt[1]);
break; } } }
if(!$filename) return false;
$tname = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);
if($tname) { if($edt) { // 오리지날 이미지 $ori = G5_URL.$data_path; // 썸네일 이미지 $src = G5_URL.str_replace($filename, $tname, $data_path); } else { $ori = G5_DATA_URL.'/file/'.$bo_table.'/'.$filename; $src = G5_DATA_URL.'/file/'.$bo_table.'/'.$tname; } } else { return false; }
$thumb = array("src"=>$src, "ori"=>$ori, "alt"=>$alt);
return $thumb; }
호출
$thumb1 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '0'); //첫번째파일 $thumb2 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '1'); //두번째파일 $thumb3 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '2'); //세번째파일 $thumb4 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '3'); //네번째파일 $thumb5 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '4'); //다섯번째파일
답변에 대한 댓글 2개
도와주셔서 감사합니다~
댓글을 작성하려면 로그인이 필요합니다.
같은 함수를 쓰고 계시니 결과값이 당연히 똑같겠죠. ㅎㅎㅎ
일단 저는 짬뽕스킨이 뭔지 몰라 소스를 보지는 못하지만...
get_list_thumbnail
get_list_thumbnail_0
get_list_thumbnail_1
1,2 라는 2개의 함수를 추가했나봅니다.
예상하건데.. get_list_thumbnail 함수는 thumnail.lib.php의 기본함수 이고, 나머지는 2번째파일, 3번째파일 을 가져오도록 커스텀마이징을 한거 같은데....
일단... get_list_thumbnail를 보시면 아시겠지만 첨부파일의 경우 limit 0, 1 로 해서 파일 한개만 가져옵니다.
에디터인 경우는 루프를 돌지만 파일만나는 순간 break를 걸어 한개만 가져오지요.
님의 경우는 첨부파일의 경우인것 같습니다.
아마도 예상컨데... limit 0, 1 limit 1, 1 limit 2, 1 이런식으로 함수를 추가하지 않았나 싶습니다.
가장 편한 방법은 마찬가지로 get_list_thumbnail_2, get_list_thumbnail_3 의 추가로 함수를 만드는 방법(각각 limit 3, 1 limit 4, 1)이 있고...
좀 고난위도 가면...
get_list_thumnail_arr 등과 같은 함수를 만든다음...파일 수 만큼 배열로 리턴하게 하는 방법이 있습니다.
좀 복잡해지겠지만 개발자라면 후자를 선택하는게 바람직합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
좋은 주말되세요