latest.php 에서 $list[$i][file][0][file] 를 불러오지를 못합니다... > 그누4 질문답변

그누4 질문답변

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

latest.php 에서 $list[$i][file][0][file] 를 불러오지를 못합니다... 정보

latest.php 에서 $list[$i][file][0][file] 를 불러오지를 못합니다...

본문

아래가 latest.php 원본이구요...

만약에 첨부파일에 이미지가 없으면 cheditor에 이미지를 호출하는건데,

 $list[$i][file][0][file]

이 변수가 호출이 안되어서요...

게시판 list.php 에서는 되는데요...

고수님들의 답변부탁드려요~


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

$img_quality = 100;


$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $g4[path]."/data/file/$bo_table";
$ym = date("ym", $g4[server_time]);

@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);


?>

<SCRIPT type=text/javascript>
<!--
old_debate_K='1';
function ComeonK(objid_K){
document.getElementById("debate_K"+old_debate_K).style.display="none";
document.getElementById("debate_K"+old_debate_K+'#1').style.display="";
document.getElementById("debate_K"+objid_K+"#1").style.display="none";
document.getElementById("debate_K"+objid_K).style.display="";
document.getElementById("debate_content_K"+old_debate_K).style.display="none";
document.getElementById("debate_content_K"+objid_K).style.display="";
old_debate_K=objid_K;
}
var objid_K = 1;
var interval_best;

function best_changeK()
{
 if( objid_K == 4 ) // 오버랩되는 갯수
  objid_K = 1;
 else
  objid_K++;

 ComeonK(objid_K);
}
function setInterval_best()
{
 interval_best = setInterval("best_changeK()",5000);//속도조절
}
function clearInterval_best()
{
 clearInterval(interval_best);
}
setInterval_best();
//-->
</SCRIPT>
<style type="text/css">
ul, li { list-style:none; margin:0; padding:0;}
#ifocus { width:240px; height:80px; margin:0px; border:0px; padding-left:22px; }

#ifocus_imglist { position:relative; }
#ifocus_imglist li { width:110px; height:60px; overflow:hidden; }
#ifocus_imglist img { width:110px; height:60px;}

#ifocus_img { float:left; position:relative; width:110px; height:60px; border:0px; overflow:hidden; }
#ifocus_img img { width:110px; height:60px; }

#ifocus_subject { float:left; position:relative; width:130px; height:60px; left:8px; top:15px; color:#6d6d6d; font-weight:bold;}
#ifocus_subject .normal { display:none; }
</style>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr><td>

<? for ($i=0; $i<count($list); $i++) {

//첨부파일이 있는경우
if ($list[$i][file][0][file] != NULL):

// Thumbnail
                  $image = $list[$i][file][0][file];
                  $ori="$g4[path]/data/file/$bo_table/" . $image;
                  $ext = strtolower(substr(strrchr($ori,"."), 1)); //확장자
                  if ( $ext=="gif" || $ext=="jpg" || $ext=="jpeg" || $ext=="png" || $ext=="bmp" || $ext=="tif" || $ext=="tiff") $ori_info=getimagesize($ori); else $ori_info="";
                  if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) { //원파일이 [ 2JPG, 2JPEG, 3PNG ] 경우.
          $file = $ori."" ;
          if ( file_exists($file) ) { // Thumbnail [O] 경우
        $thum_info = getimagesize ($file);
    $thum_W = $thum_info[0] ;
    $thum_H = $thum_info[1] ;
            } else { // Thumbnail [X] 경우
      if ( smaller( $ori_info[0], $ori_info[1] ) ) {
maker( $thum_W, $thum_H );
    }
        }
                } else if ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) { //원파일이 [ 1GIF,6BMP,7TIF ] 경우.
    if ( smaller( $ori_info[0], $ori_info[1] ) ) {
$file = $ori ;
    }
              } else { //원파일이 [ 1,2,3,6,7 ] 아닐 경우.
              $file = $noIMG ;
              }
 
else:
//cheditor을 이용한 첨부인 경우

//썸네일 생성

// 썸네일 파일이 같은게 존재하는지 확인하기위한 변수생성
$img_step1 = explode("_",$list[$i][file][$i][file]);
$img_step2 = explode(".",$img_step1[1]);
$new_imgname = $img_step2[0];

$thumb = $thumb_path.'/'.$list[$i][wr_id]."_".$new_imgname;
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {

$size = getimagesize($file);

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


// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id]."_".$new_imgname, $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
} else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
$edit_img = $list[$i]['wr_content'];
if (eregi("data/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // data/geditor------
$file = '../' . $tmp[0]; // 파일명

}
}
}
endif;
$j = $i + 1; 
if ($j == "1") {

echo "<DIV>";
echo "<DIV id=debate_content_K$j onmouseover=clearInterval_best() onmouseout=setInterval_best()>"; }
else { echo "<DIV id=debate_content_K$j onmouseover=clearInterval_best() onmouseout=setInterval_best() style='DISPLAY: none;'>\n"; }
?>
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
 <tr><td>
<div id="ifocus">
<div id="ifocus_imglist" style="left:0; top:0;"></div> 
<div id="ifocus_img">
<a href="<?=$list[$i][href]?>"><img src="<?=$file?>" alt="상세보기"></a>
</div>
<div id="ifocus_subject">
<a href="<?=$list[$i][href]?>"><?=$list[$i]['subject']?><? echo $list[$i][file][0][file]; ?> </a>
</div>
<div id="ifocus_ico">
</div>
</div>
</td>
</tr>
</table>
<?
echo "</DIV>";
}
?>

<div id="button1" style="width:180px; text-align:right; visibility:hidden; margin-top:-96px; margin-left:0px;">
    <? for ($i=0; $i<count($list); $i++) {
    $k = $i + 1;
    ?>
    <a href="<?=$list[$i][href]?>" onmouseover="javascript:ComeonK('<?=$k?>')"><img src="<?=$latest_skin_path?>/img/<?=$k?>_on.gif" width="12" height="12" border="0" id="debate_K<?=$k?>" onmouseover="clearInterval_best()" onmouseout="setInterval_best()" <? if($k == "1") { echo ""; } else { echo "style='DISPLAY: none;' "; } ?>><img src="<?=$latest_skin_path?>/img/<?=$k?>.gif" width="12" height="12" border="0"  id="debate_K<?=$k?>#1"  <? if($k == "1") { echo "style='DISPLAY: none;'"; } else { echo ""; } ?>></a>
    <? } ?>
</div>
</td>
</tr></table>
  • 복사

댓글 전체

© SIRSOFT
현재 페이지 제일 처음으로