최신글에 bmp파일도 출력되게 도와주세요. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

최신글에 bmp파일도 출력되게 도와주세요. 정보

최신글에 bmp파일도 출력되게 도와주세요.

본문

아래 최신글 스킨을 사용중인데요. 병원이다 보니 x-ray같은 파일이 전부 확장자가bmp네요.
관리자모드에서 bmp 허용해줘도 view.sin.php 에서만 보이고 리스트나 최신글에서는 안보이네요.
최신글에서 보일 수 있게 도움을 부탁드립니다.

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 스킨 입니다.");

$la_content = "35"; //내용길이
$img_w = "87"; //썸네일 가로
$img_h = "61"; //썸네일 세로

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_'.$img_w.'_'.$img_h;

@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<style type="text/css">
#photo_v27_img, #photo_v27_list{float:left}
#photo_v27_img{width:10px;border:0px solid #ffffff;padding:3px;}
#photo_v27_list{
 width:200px;
 height:80px;
 padding:0 0 0 5px;
 color:#000000;
 font-family: "돋움";
 font-size: 9pt;
 text-decoration: none;
}
.photo_v27_sub{
 height:18px;
 font-family: "돋움";
 font-size: 9pt;
 font-weight: bold;
 text-decoration: none;
}
.photo_v27_con {
 height:17px;
 font-family: "돋움";
 font-size: 8pt;
 font-weight: normal;
 text-decoration: none;
}
</style>
<?
for ($i=0; $i<count($list); $i++) {
//썸네일 코드 시작
    $img = "<div style='width:100px;height:55px;'></div>";
    $thumb = $thumb_path . '/' . $list[$i][file][0][file] . '.thumb';
    if (!file_exists($thumb))
    {
        $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
        if (preg_match("/\.(jp[e]?g|gif|bmp|png)$/i", $file) && file_exists($file))
        {
            $size = getimagesize($file);
            if ($size[2] == 1)
                $src = imagecreatefromgif($file);
            else if ($size[2] == 2)
                $src = imagecreatefromjpeg($file);
            else if ($size[2] == 3)
                $src = imagecreatefrompng($file);
   
            else
                continue;

            $rate = $img_w / $size[0];
            $height = (int)($size[1] * $rate);

            if ($height < $img_h)
                $dst = imagecreatetruecolor($img_w, $height);
            else
                $dst = imagecreatetruecolor($img_w, $img_h);
            imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $height, $size[0], $size[1]);
            imagejpeg($dst, $thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 100);
            chmod($thumb_path . '/' . $list[$i][file][0][file] . '.thumb', 0606);
        }
    }

    if (file_exists($thumb))
        $img = "<img src='$thumb' align='absmiddle' border='0'>";

    $href = "{$list[$i][href]}";

    $wr_1 = "<span $href>".cut_str($list[$i][wr_1],12)."</span>";
    $wr_content ="<span $style>".cut_str(strip_tags($list[$i][wr_content]),$la_content)."</span>";
// 출력
    echo <<<HEREDOC
<div>
 <div id="photo_v27_img">
  <table  width=103 border="0" cellspacing="0" cellpadding="0">
  <tr><td width=30></td><td>
  <table  border="0" cellspacing="0" cellpadding="0">
<tr><td height=10></td></tr>
  <tr><td align=center>
  <a href='{$href}' onfocus='this.blur()'>{$img}</a>
  </td></tr>
   <tr><td height=7 align=center></td></tr>
  
   <tr><td align=center height=3><a href='{$href}' onfocus='this.blur()' class=red>
   <b>$wr_1</b></td></tr>

  </table>
   </td></tr></table>

</div>
HEREDOC;
}
?>
<? if (count($list) == 0) { ?>
<div style="height:25px;" align="center"><br> 게시물이 없습니다.</div>
<? } ?>

  • 복사

댓글 전체

관리자모드에서는 이미 설정했습니다.
현재 리스트와 최신글에서추출에서 bmp 파일이 보이지 않으며, bmp 파일을 첨부시키면 전체 게시물이 다 안보이게 되어 버립니다.
관리자 설정에서 bmp 확장자 추가하는거와는 별개입니다.
기본적인 갤러리스킨에서 bmp 파일 썸네일 지원은 못하고 있는걸로 알고 있는데요..
이런경우
원본을 불러와서 출력 시켜줘야 할것같습니다.

위소스에서
 if (preg_match("/\.(jp[e]?g|gif|bmp|png)$/i", $file) && file_exists($file))

 if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file))
로 수정하고

----

    if (file_exists($thumb))
        $img = "<img src='$thumb' align='absmiddle' border='0'>";

if (preg_match("/\.(bmp)$/i", $file) && file_exists($file)) //bmp 파일일경우
$img = $list[$i][file][0][file]; //원본이미지 출력
    if (file_exists($thumb)) //썸네일이 있다면
        $img = $thumb; //썸네일출력
로 수정



<a href='{$href}' onfocus='this.blur()'><img src='{$img}' width='87' height='61' border='0'></a>

이렇게 해보세요.
© SIRSOFT
현재 페이지 제일 처음으로