리스트에서 파일 설명을 나타내려면 어케하죠? 정보
리스트에서 파일 설명을 나타내려면 어케하죠?본문
안녕하세요~~
제가 궁금한게 있어서 질문을 드렸었는데 부용님께서 올려주신 내용~~
===================================================================
$f_arr = array();
for($a=0, $f=0; $f < $list[$i][file][count]; $f++)//첨부파일 전체 갯수만큼 돈다.
{
if ($list[$i][file][$f][file])
{
$f_arr[$a] = array( 'file' => urlencode($list[$i][file][$f][file]), 'path' => $list[$i][file][$f][path], 'source' => $list[$i][file][$f][source], 'datetime' => $list[$i][file][$f][datetime], 'bf_content' => $list[$i][file][$f][bf_content] );//필요한거 배열에 담는다.
$file = $list[$i][file][$f][file];
$dest_file = $data_path .'/'. $file;//원본 이미지
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($dest_file))
{
$thumb = $thumb_path.'/' . $file;
if (!file_exists($thumb))
{
$size = getimagesize($dest_file);
if ($size[2] == 1)
$src = imagecreatefromgif($dest_file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($dest_file);
else if ($size[2] == 3)
$src = imagecreatefrompng($dest_file);
else
break;
if ($size[0] >= $size[1])
{
//최대 사이즈 제한 방식(bo_1 썸네일 최대제한 사이즈, bo_2 썸네일 퀄리티)
$rate = $board[bo_1] / $size[0];
$width = $board[bo_1];
$height = (int)($size[1] * $rate);
}
else
{
$rate = $board[bo_1] / $size[1];
$width = (int)($size[0] * $rate);
$height = $board[bo_1];
}
$dst = imagecreatetruecolor($width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
imagepng($dst, $thumb, $board['bo_2']);
chmod($thumb, 0707);
}
}
if (file_exists($thumb))
{
$img = "<a href='".$f_arr[$a][path]."/".$f_arr[$a][file]."' title='".$f_arr[$a][source]."/".$f_arr[$a]['datetime']."'><img src='".$thumb_path."/".$f_arr[$a][file]."' style='border: 1px solid silver;' title='".$f_arr[$a][source]."/".$f_arr[$a]['datetime']."'></a>";
}
$a ++;
if (sizeof($f_arr) <= 5)//게시물당 보여줄 첨부파일 갯수 5
{
echo $img;
}
}
}
====================================================================
입니다.
마지막 echo $img;가 실제 이미지를 출력하는건 알겠습니다..ㅠㅠ
그런데 이미지 아래에 파일 설명을 나오게 하려면 어케하죠?
보통 view에서는 echo "{$view[file][$a][content]}"; 사용을 하는데 리스트라서 그런지 아님 코드 안에라서 그런건지 모르겠네요.
찾아보니 bf_content가 파일설명이라던데 안나오네요...쩝
게시판 설정에서 파일 설명 사용에 체크를 해도 안되네요.
부탁드립니다.
제가 궁금한게 있어서 질문을 드렸었는데 부용님께서 올려주신 내용~~
===================================================================
$f_arr = array();
for($a=0, $f=0; $f < $list[$i][file][count]; $f++)//첨부파일 전체 갯수만큼 돈다.
{
if ($list[$i][file][$f][file])
{
$f_arr[$a] = array( 'file' => urlencode($list[$i][file][$f][file]), 'path' => $list[$i][file][$f][path], 'source' => $list[$i][file][$f][source], 'datetime' => $list[$i][file][$f][datetime], 'bf_content' => $list[$i][file][$f][bf_content] );//필요한거 배열에 담는다.
$file = $list[$i][file][$f][file];
$dest_file = $data_path .'/'. $file;//원본 이미지
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($dest_file))
{
$thumb = $thumb_path.'/' . $file;
if (!file_exists($thumb))
{
$size = getimagesize($dest_file);
if ($size[2] == 1)
$src = imagecreatefromgif($dest_file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($dest_file);
else if ($size[2] == 3)
$src = imagecreatefrompng($dest_file);
else
break;
if ($size[0] >= $size[1])
{
//최대 사이즈 제한 방식(bo_1 썸네일 최대제한 사이즈, bo_2 썸네일 퀄리티)
$rate = $board[bo_1] / $size[0];
$width = $board[bo_1];
$height = (int)($size[1] * $rate);
}
else
{
$rate = $board[bo_1] / $size[1];
$width = (int)($size[0] * $rate);
$height = $board[bo_1];
}
$dst = imagecreatetruecolor($width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
imagepng($dst, $thumb, $board['bo_2']);
chmod($thumb, 0707);
}
}
if (file_exists($thumb))
{
$img = "<a href='".$f_arr[$a][path]."/".$f_arr[$a][file]."' title='".$f_arr[$a][source]."/".$f_arr[$a]['datetime']."'><img src='".$thumb_path."/".$f_arr[$a][file]."' style='border: 1px solid silver;' title='".$f_arr[$a][source]."/".$f_arr[$a]['datetime']."'></a>";
}
$a ++;
if (sizeof($f_arr) <= 5)//게시물당 보여줄 첨부파일 갯수 5
{
echo $img;
}
}
}
====================================================================
입니다.
마지막 echo $img;가 실제 이미지를 출력하는건 알겠습니다..ㅠㅠ
그런데 이미지 아래에 파일 설명을 나오게 하려면 어케하죠?
보통 view에서는 echo "{$view[file][$a][content]}"; 사용을 하는데 리스트라서 그런지 아님 코드 안에라서 그런건지 모르겠네요.
찾아보니 bf_content가 파일설명이라던데 안나오네요...쩝
게시판 설정에서 파일 설명 사용에 체크를 해도 안되네요.
부탁드립니다.
댓글 전체
리스트페이지와 뷰페이지의 차이점은 변수명입니다
view[file][$a][content] <--뷰 페이지
list[file][$a][content]<-- 리스트 페이지
view[file][$a][content] <--뷰 페이지
list[file][$a][content]<-- 리스트 페이지
아...그렇군요.
한번 해봐야겠네요.^^;;
균이님 감사합니다~
한번 해봐야겠네요.^^;;
균이님 감사합니다~