카

최신글 이미지 관련 질문드립니다.

· 2012-08-23 (목) 15:19:42 · 896 · 2
최신글 불러올때 첨부된 이미지가 있으면 1번째 이미지를 보여주는 스킨을

사용중입니다. 첨부된 이미지가 없을땐 지정해준 이미지 파일을 불러옵니다.

이게 로컬에서 테스트 할땐 잘 됩니다.

그런데 테스트겸해서 웹호스팅에 올리면 첨부된 이미지가 없을때 지정해준

이미지 파일을 불러오지 못합니다.

경로도 이리저리 바꿔보고 여러경로에 no-image파일을 올려서

테스트를 해봐도 되질 않습니다.

혹시 무엇인 문제인지 아시는분이 계시지 않을까 해서 글을 남겨봅니다.

호스팅은 카페24를 사용중이고 아래는 스킨 소스입니다.

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

$cols = 4; // 이미지 가로갯수 // 이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$imgwidth=150; //표시할 이미지의 가로사이즈
$imgheight=100; //표시할 이미지의 세로사이즈
$image_h = 5; // 이미지 상하 간격

$col_width = (int)(99 / $cols);

$data_path = $g4[path]."/data/file/$bo_table";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="0078ff">
<tr>
<td height="89">
<table width="100%" border="0" cellpadding="0" cellspacing="4" bgcolor="FFFFFF">
<tr>
<td align=center valign="top" bgcolor="FFFFFF" style="padding:0px" height="71">
<table width="97%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor=#FFFFFF>
<td height="22"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><strong><?=$board[bo_subject]?></strong></a></td>
<td align="right">  <a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?>/img/more.png" border="0"></span></a></td>
</tr>
<tr><td colspan=2 height="1" bgcolor=EEEEEE></td></tr>
<tr><td colspan=2 height="3"></td></tr>
</table>
<!-- 최신글 제목 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>

<? for ($i=0; $i<count($list); $i++) {
if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
?>

<td width="<?=$col_width?>%" align="center" valign='top'>

<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
if ( is_file($thumb) ) {
$img = $thumb;
}elseif( !is_file($img) ) {
$img = "/img/no_image.gif";
}

echo $list[$i][icon_reply] . " ";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
echo "<tr><td valign='top' align='center'><a href='{$list[$i]['href']}'><img src='$img' width='{$imgwidth}' height='{$imgheight}' align='absmiddle' style='width:{$imgwidth}px;height:{$imgheight}px;border:0px solid #CCCCCC; padding:0px'></a></td></tr>";
echo "<tr><td align='center' height='21'><a href='{$list[$i]['href']}'><span style='font-size:8pt;'>{$list[$i]['subject']}</span></a></td></tr></table>";
?>
</td>
<? } ?>

<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%> </td>";
}
?>

<? if (count($list) == 0) { echo "<td align=center>게시물이 없습니다.</td>"; } ?>
</tr>
<tr>
<td width="1%" height="1" align="center" valign="top">
<tr>
</td></tr>
</table>

</td></tr>
</table>
</td></tr>
</table>
--------------------------------소스 끝-----------------------------------------

<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
if ( is_file($thumb) ) {
$img = $thumb;
}elseif( !is_file($img) ) {
$img = "/img/no_image.gif"; //이미지 없을때 출력 경로
}

소스는 위와 같습니다.

문제를 아시는분 답변 기다리겠습니다

그럼 수고하세요~~/
|

댓글 2개

2012-08-24 (금) 01:32:36
elseif( !is_file($img) ) {

echo '여기로 오니?';
exit;

$img = "/img/no_image.gif"; //이미지 없을때 출력 경로
}

여기로 구문을 타는지 부터 확인해보세요

아님 else{
$img = "/img/no_image.gif"; //이미지 없을때 출력 경로
}

해서 테스트 해보시고요
2012-08-24 (금) 11:18:15
아.. 문제는 다른데 있었네요 ㅎㅎ;;

그래도 모니터군님 글보고 이것저것 해보다 답을 찾았습니다.

이미지 파일이 아닌 일반 파일이 첨부가 되어있어서 그렇더군요 ㅎㅎ;;

이것땜시 하루동안 삽질한듯 ㅎㅎ;;

수고하세요~
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

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

+
제목 글쓴이 날짜 조회
12-08-24 조회 1,084
12-08-24 조회 689
12-08-24 조회 894
12-08-24 조회 611
12-08-24 조회 870
12-08-24 조회 940
12-08-24 조회 2,810
12-08-24 조회 1,759
12-08-23 조회 1,122
12-08-23 조회 1,617
12-08-23 조회 1,692
12-08-23 조회 1,198
12-08-23 조회 822
12-08-23 조회 868
12-08-23 조회 794
12-08-23 조회 1,101
12-08-23 조회 897
12-08-23 조회 1,089
12-08-23 조회 1,101
12-08-23 조회 1,693