최신글 이미지(썸네일)이 안나와요 ㅠㅠ 정보
최신글 이미지(썸네일)이 안나와요 ㅠㅠ본문
제가 다른 스킨을 조금 수정하면서 작업을 하는데.
좌측에 웹진형 최신글2개 우측에 그외 8개 최신리스트가 표시되게 만드는 식입니다.
그런데 해당 게시판에 이미지 추가(파일첨부 아님)로 했을경우
웹진형글에 썸네일에 안나오고 내용란에 이미지가 크게 표시가 됩니다.
파일첨부 말고. 이미지추가 기능으로 넣은 이미지를
표시하고 싶습니다 ㅠㅠ
아래는 코드 입니다..
// 미리보기 이미지사이즈
$img_w = "108";
$img_h = "80";
?>
<h3>웹표준 코딩</h3>
<div class="more"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"><img src="images/more.gif" alt="" /></a></div>
<div class="con_l">
<div class="con_00">
<? for ($i=0; $i<count($list); $i++) {
$ca_img = "<img src='images/barr.gif' alt='' />";
?>
<? if ($i<=1) { ?>
<div class="main_sub">
<h4><? if($list[$i]['icon_new']){?><span class="new">[new]</span><? } ?><a href="<?=$list[$i][href]?>"><?=$list[$i][subject]?></a></h4>
<? $image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image) && file_exists("$g4[path]/data/file/$bo_table/$image")) {
echo "<a href='{$list[$i][href]}'><img src='$g4[path]/data/file/$bo_table/$image' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>";
} else {
echo "<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/no_img.gif' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>"; //이미지가 없는 경우 no 이미지로 대체
} ?>
<div class="main_con">
<P><a href="<?=$list[$i][href]?>"><?=nl2br(cut_str($list[$i][wr_content],150))?></a></P>
</div>
<div class="name">
<P><?=$list[$i][wr_datetime]?> <?=$list[$i][wr_name]?></P>
</div>
</div>
<? } else if($i==2){ ?>
</div>
<div class="main_01">
<ul>
<li> <?=$ca_img?> <span><a href='<?=$list[$i][href]?>'><?=nl2br(cut_str($list[$i][subject],40))?></a></span><span class="date"><?=$list[$i][wr_name]?></span></li>
<? } else{ ?>
<li> <?=$ca_img?> <span><a href='<?=$list[$i][href]?>'><?=nl2br(cut_str($list[$i][subject],40))?></a></span><span class="date"><?=$list[$i][wr_name]?></span></li>
<? } ?>
<? } ?>
</ul>
</div>
</div>
좌측에 웹진형 최신글2개 우측에 그외 8개 최신리스트가 표시되게 만드는 식입니다.
그런데 해당 게시판에 이미지 추가(파일첨부 아님)로 했을경우
웹진형글에 썸네일에 안나오고 내용란에 이미지가 크게 표시가 됩니다.
파일첨부 말고. 이미지추가 기능으로 넣은 이미지를
표시하고 싶습니다 ㅠㅠ
아래는 코드 입니다..
// 미리보기 이미지사이즈
$img_w = "108";
$img_h = "80";
?>
<h3>웹표준 코딩</h3>
<div class="more"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"><img src="images/more.gif" alt="" /></a></div>
<div class="con_l">
<div class="con_00">
<? for ($i=0; $i<count($list); $i++) {
$ca_img = "<img src='images/barr.gif' alt='' />";
?>
<? if ($i<=1) { ?>
<div class="main_sub">
<h4><? if($list[$i]['icon_new']){?><span class="new">[new]</span><? } ?><a href="<?=$list[$i][href]?>"><?=$list[$i][subject]?></a></h4>
<? $image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image) && file_exists("$g4[path]/data/file/$bo_table/$image")) {
echo "<a href='{$list[$i][href]}'><img src='$g4[path]/data/file/$bo_table/$image' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>";
} else {
echo "<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/no_img.gif' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>"; //이미지가 없는 경우 no 이미지로 대체
} ?>
<div class="main_con">
<P><a href="<?=$list[$i][href]?>"><?=nl2br(cut_str($list[$i][wr_content],150))?></a></P>
</div>
<div class="name">
<P><?=$list[$i][wr_datetime]?> <?=$list[$i][wr_name]?></P>
</div>
</div>
<? } else if($i==2){ ?>
</div>
<div class="main_01">
<ul>
<li> <?=$ca_img?> <span><a href='<?=$list[$i][href]?>'><?=nl2br(cut_str($list[$i][subject],40))?></a></span><span class="date"><?=$list[$i][wr_name]?></span></li>
<? } else{ ?>
<li> <?=$ca_img?> <span><a href='<?=$list[$i][href]?>'><?=nl2br(cut_str($list[$i][subject],40))?></a></span><span class="date"><?=$list[$i][wr_name]?></span></li>
<? } ?>
<? } ?>
</ul>
</div>
</div>
댓글 전체
<? $image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image) && file_exists("$g4[path]/data/file/$bo_table/$image")) {
echo "<a href='{$list[$i][href]}'><img src='$g4[path]/data/file/$bo_table/$image' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>";
}else {
echo "<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/no_img.gif' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>"; //이미지가 없는 경우 no 이미지로 대체
} ?>
부분을
<? $image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image) && file_exists("$g4[path]/data/file/$bo_table/$image")) {
echo "<a href='{$list[$i][href]}'><img src='$g4[path]/data/file/$bo_table/$image' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>";
}else {
$content = $list[$i][wr_content]; // 내용에서 <img.*> 태그의 전체 코드를 얻음
preg_match("/(<img[^>]+>)/i", $content, $matches);
$img = $matches[1]; // <img.*> 태그에서 src 의 코드만 얻음
preg_match("/src\=[\"\']?([^\"\'\s\>]+)/i", $img, $matches);
$src_str = $matches[1];
if($src_str)
{
echo "<a href='{$list[$i][href]}'><img src='$src_str' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>";
}
else
{
echo "<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/no_img.gif' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>"; //이미지가 없는 경우 no 이미지로 대체
}
} ?>
nine 님의 http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=134984 웹진 게시판 소스를 참조하였습니다
if (preg_match("/\.(gif|jpg|png)$/i", $image) && file_exists("$g4[path]/data/file/$bo_table/$image")) {
echo "<a href='{$list[$i][href]}'><img src='$g4[path]/data/file/$bo_table/$image' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>";
}else {
echo "<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/no_img.gif' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>"; //이미지가 없는 경우 no 이미지로 대체
} ?>
부분을
<? $image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image) && file_exists("$g4[path]/data/file/$bo_table/$image")) {
echo "<a href='{$list[$i][href]}'><img src='$g4[path]/data/file/$bo_table/$image' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>";
}else {
$content = $list[$i][wr_content]; // 내용에서 <img.*> 태그의 전체 코드를 얻음
preg_match("/(<img[^>]+>)/i", $content, $matches);
$img = $matches[1]; // <img.*> 태그에서 src 의 코드만 얻음
preg_match("/src\=[\"\']?([^\"\'\s\>]+)/i", $img, $matches);
$src_str = $matches[1];
if($src_str)
{
echo "<a href='{$list[$i][href]}'><img src='$src_str' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>";
}
else
{
echo "<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/no_img.gif' width='{$img_w}' height='{$img_h}' border='0' alt='' /></a>"; //이미지가 없는 경우 no 이미지로 대체
}
} ?>
nine 님의 http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=134984 웹진 게시판 소스를 참조하였습니다
아 감사합니다. 덕분에 잘 되었습니다. 웹진 게시판 소스 링크 덕분에 좀더 좋은 결과를 얻었습니다. 정말 감사합니다 ㅠㅠ