답변 3개 / 댓글 9개
에디터로 올리시는 경우라면
list.skin.php 목록상에 썸네일 출력되는 부분에
if (eregi("<embed.*src=\"//www.youtube.com/v/([^&]+)&?",$list[$i][wr_content])) { //오브젝트 유튜브동영상올린경우(썸네일보다 우선함)
preg_match("/<embed.*?src=[\"']\/\/www\.youtube\.com\/v\/([^?]+)\?(.*?)['\"]/", $list[$i][wr_content], $matches);
$v = $matches[1];
$thumb="<a href='".$list[$i][href]."'><img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle'>";
preg_match("/<embed.*?src=[\"']\/\/www\.youtube\.com\/v\/([^?]+)\?(.*?)['\"]/", $list[$i][wr_content], $matches);
$v = $matches[1];
$thumb="<a href='".$list[$i][href]."'><img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle'>";
}elseif (file_exists($thumb)) { // 썸네일이 있다면
$thumb = "<a href='".$list[$i][href]."'><img src='".$thumb."' align='absmiddle'></a>";
}else{ //썸네일이 없다면
$thumb = "IMAGE NONE";
}
답변에 대한 댓글 6개
에디터에 플래시동영상으로 올리든 미디어로 올리든 오브젝트(이전소스코드)로 올리시면 리스트 화면에 썸네일이 알아서 뜰거에요.
즉 위 코드는 유튜브에서 지원하는 동영상 썸네임을 동영상 코드 id만 추출해서 썸네일 id와 일치하는걸 뽑아내는거거든요.
단,
$thumb="<a href='".$list[$i][href]."'><img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle'>";
이부분에서 장미란님의 목록에 맞게 썸네일 사이즈는 조정하셔야할겁니다.
즉 이렇게
$thumb="<a href='".$list[$i][href]."'><img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle' width="가로사이즈" height="세로사이즈">";
즉 위 코드는 유튜브에서 지원하는 동영상 썸네임을 동영상 코드 id만 추출해서 썸네일 id와 일치하는걸 뽑아내는거거든요.
단,
$thumb="<a href='".$list[$i][href]."'><img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle'>";
이부분에서 장미란님의 목록에 맞게 썸네일 사이즈는 조정하셔야할겁니다.
즉 이렇게
$thumb="<a href='".$list[$i][href]."'><img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle' width="가로사이즈" height="세로사이즈">";
히어님 아래처럼 넣었는데 안돼네요 머가 잘못된걸가여 ㅜㅡ
<!-- 목록 -->
<form name="fboardlist" method="post">
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
<input type='hidden' name='sfl' value='<?=$sfl?>'>
<input type='hidden' name='stx' value='<?=$stx?>'>
<input type='hidden' name='spt' value='<?=$spt?>'>
<input type='hidden' name='page' value='<?=$page?>'>
<input type='hidden' name='sw' value=''>
<table width="100%" cellpadding='0' cellspacing='0'>
<tr><td colspan='<?=$mod?>' height='5'></td></tr>
<tr><td colspan='<?=$mod?>' height='1' bgcolor='#DEE3E7'></td></tr>
<tr>
<?
for ($i=0; $i<count($list); $i++) {
if (eregi("<embed.*src=\"//www.youtube.com/v/([^&]+)&?",$list[$i][wr_content])) { //오브젝트 유튜브동영상올린경우(썸네일보다 우선함)
preg_match("/<embed.*?src=[\"']\/\/www\.youtube\.com\/v\/([^?]+)\?(.*?)['\"]/", $list[$i][wr_content], $matches);
$v = $matches[1];
$thumb="<a href='".$list[$i][href]."'><img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle' width='250' height='300'>";
}elseif (file_exists($thumb)) { // 썸네일이 있다면
$thumb = "<a href='".$list[$i][href]."'><img src='".$thumb."' align='absmiddle'></a>";
}else{ //썸네일이 없다면
$thumb = "IMAGE NONE";
}
href
if($list[$i][wr_link1]){
$href = $list[$i][wr_link1];
$target = "_blank";
}else{
$href = $list[$i][href];
$target = "_self";
}
if ($i && $i%$mod==0)
echo "</tr><tr>";
$style = "";
$subject = "<span $style>{$list[$i][subject]}</span>";
$comment_cnt = "";
if ($list[$i][comment_cnt])
$comment_cnt = " <a href=\"{$list[$i][comment_href]}\"><span style='font-size:10px;'><font face='Tahoma' color='#EE5A00'>{$list[$i][comment_cnt]}</span></a>";
$list[$i][name] = preg_replace("/<img /", "<img style='display:none;' ", $list[$i][name]);
$list[$i][name] = preg_replace("/> <span/", "><span", $list[$i][name]);
$list[$i][name] = preg_replace("/class='member'/", "", $list[$i][name]);
echo "<td width='{$td_width}%' valign=top style='word-break:break-all; padding:0px;'>";
echo "<table align=center>";
echo "<tr><td height=15></td></tr>";
echo "<tr><td align=center><div style='float:left; border:1px solid #ccc; background:#fff; padding:4px; font-size:0; line-height:0;'><a href='{$href}' target='{$target}'>".makeThumbs($g4[path]."/data/file/$bo_table", $list[$i][file][0][file], $board[bo_1], $board[bo_2], cut_str($list[$i][subject],20))."</a></div></td></tr>";
//echo "<tr><td align=center style='font-size:11px; color:#888;'>Date.".$list[$i][datetime2]." / Hit.".$list[$i][wr_hit]."</td></tr>";
echo "<tr><td align=center class=lh>";
if ($is_category) echo "<a href='{$list[$i][ca_name_href]}'>[{$list[$i][ca_name]}]</a> ";
echo "<a href='{$list[$i][href]}'>$subject</a><span class='comment'>{$comment_cnt}</span>";
//echo " " . $list[$i][icon_new];
//echo " " . $list[$i][icon_file];
//echo " " . $list[$i][icon_link];
//echo " " . $list[$i][icon_hot];
//echo " " . $list[$i][icon_secret];
echo "</td></tr>";
if ($is_checkbox) echo "<tr><td align=center><input type=checkbox name=chk_wr_id[] value='{$list[$i][wr_id]}'></td></tr>";
echo "</table></td>\n";
}
// 나머지 td
$cnt = $i%$mod;
if ($cnt)
for ($i=$cnt; $i<$mod; $i++)
echo "<td width='{$td_width}%'> </td>";
?>
</tr>
<? if (count($list) == 0) { echo "<tr><td colspan='$mod' height=100 align=center>게시물이 없습니다.</td></tr>"; } ?>
<tr><td colspan='<?=$mod?>' height='15'></td></tr>
<tr><td colspan=<?=$mod?> bgcolor='#DEE3E7' height='1'>
</table>
</form>
<!-- 목록 -->
<form name="fboardlist" method="post">
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
<input type='hidden' name='sfl' value='<?=$sfl?>'>
<input type='hidden' name='stx' value='<?=$stx?>'>
<input type='hidden' name='spt' value='<?=$spt?>'>
<input type='hidden' name='page' value='<?=$page?>'>
<input type='hidden' name='sw' value=''>
<table width="100%" cellpadding='0' cellspacing='0'>
<tr><td colspan='<?=$mod?>' height='5'></td></tr>
<tr><td colspan='<?=$mod?>' height='1' bgcolor='#DEE3E7'></td></tr>
<tr>
<?
for ($i=0; $i<count($list); $i++) {
if (eregi("<embed.*src=\"//www.youtube.com/v/([^&]+)&?",$list[$i][wr_content])) { //오브젝트 유튜브동영상올린경우(썸네일보다 우선함)
preg_match("/<embed.*?src=[\"']\/\/www\.youtube\.com\/v\/([^?]+)\?(.*?)['\"]/", $list[$i][wr_content], $matches);
$v = $matches[1];
$thumb="<a href='".$list[$i][href]."'><img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle' width='250' height='300'>";
}elseif (file_exists($thumb)) { // 썸네일이 있다면
$thumb = "<a href='".$list[$i][href]."'><img src='".$thumb."' align='absmiddle'></a>";
}else{ //썸네일이 없다면
$thumb = "IMAGE NONE";
}
href
if($list[$i][wr_link1]){
$href = $list[$i][wr_link1];
$target = "_blank";
}else{
$href = $list[$i][href];
$target = "_self";
}
if ($i && $i%$mod==0)
echo "</tr><tr>";
$style = "";
$subject = "<span $style>{$list[$i][subject]}</span>";
$comment_cnt = "";
if ($list[$i][comment_cnt])
$comment_cnt = " <a href=\"{$list[$i][comment_href]}\"><span style='font-size:10px;'><font face='Tahoma' color='#EE5A00'>{$list[$i][comment_cnt]}</span></a>";
$list[$i][name] = preg_replace("/<img /", "<img style='display:none;' ", $list[$i][name]);
$list[$i][name] = preg_replace("/> <span/", "><span", $list[$i][name]);
$list[$i][name] = preg_replace("/class='member'/", "", $list[$i][name]);
echo "<td width='{$td_width}%' valign=top style='word-break:break-all; padding:0px;'>";
echo "<table align=center>";
echo "<tr><td height=15></td></tr>";
echo "<tr><td align=center><div style='float:left; border:1px solid #ccc; background:#fff; padding:4px; font-size:0; line-height:0;'><a href='{$href}' target='{$target}'>".makeThumbs($g4[path]."/data/file/$bo_table", $list[$i][file][0][file], $board[bo_1], $board[bo_2], cut_str($list[$i][subject],20))."</a></div></td></tr>";
//echo "<tr><td align=center style='font-size:11px; color:#888;'>Date.".$list[$i][datetime2]." / Hit.".$list[$i][wr_hit]."</td></tr>";
echo "<tr><td align=center class=lh>";
if ($is_category) echo "<a href='{$list[$i][ca_name_href]}'>[{$list[$i][ca_name]}]</a> ";
echo "<a href='{$list[$i][href]}'>$subject</a><span class='comment'>{$comment_cnt}</span>";
//echo " " . $list[$i][icon_new];
//echo " " . $list[$i][icon_file];
//echo " " . $list[$i][icon_link];
//echo " " . $list[$i][icon_hot];
//echo " " . $list[$i][icon_secret];
echo "</td></tr>";
if ($is_checkbox) echo "<tr><td align=center><input type=checkbox name=chk_wr_id[] value='{$list[$i][wr_id]}'></td></tr>";
echo "</table></td>\n";
}
// 나머지 td
$cnt = $i%$mod;
if ($cnt)
for ($i=$cnt; $i<$mod; $i++)
echo "<td width='{$td_width}%'> </td>";
?>
</tr>
<? if (count($list) == 0) { echo "<tr><td colspan='$mod' height=100 align=center>게시물이 없습니다.</td></tr>"; } ?>
<tr><td colspan='<?=$mod?>' height='15'></td></tr>
<tr><td colspan=<?=$mod?> bgcolor='#DEE3E7' height='1'>
</table>
</form>
<!-- 목록 -->
<form name="fboardlist" method="post">
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
<input type='hidden' name='sfl' value='<?=$sfl?>'>
<input type='hidden' name='stx' value='<?=$stx?>'>
<input type='hidden' name='spt' value='<?=$spt?>'>
<input type='hidden' name='page' value='<?=$page?>'>
<input type='hidden' name='sw' value=''>
<table width="100%" cellpadding='0' cellspacing='0'>
<tr><td colspan='<?=$mod?>' height='5'></td></tr>
<tr><td colspan='<?=$mod?>' height='1' bgcolor='#DEE3E7'></td></tr>
<tr>
<?
for ($i=0; $i<count($list); $i++) {
if($list[$i][wr_link1]){
$href = $list[$i][wr_link1];
$target = "_blank";
}else{
$href = $list[$i][href];
$target = "_self";
}
if ($i && $i%$mod==0)
echo "</tr><tr>";
$style = "";
$subject = "<span $style>{$list[$i][subject]}</span>";
$comment_cnt = "";
if ($list[$i][comment_cnt])
$comment_cnt = " <a href=\"{$list[$i][comment_href]}\"><span style='font-size:10px;'><font face='Tahoma' color='#EE5A00'>{$list[$i][comment_cnt]}</span></a>";
$list[$i][name] = preg_replace("/<img /", "<img style='display:none;' ", $list[$i][name]);
$list[$i][name] = preg_replace("/> <span/", "><span", $list[$i][name]);
$list[$i][name] = preg_replace("/class='member'/", "", $list[$i][name]);
$thumb = makeThumbs($g4[path]."/data/file/".$bo_table, $list[$i][file][0][file], $board[bo_1], $board[bo_2], cut_str($list[$i][subject],20));
if (eregi("<embed.*src=\"//www.youtube.com/v/([^&]+)&?",$list[$i][wr_content])) { //오브젝트 유튜브동영상올린경우(썸네일보다 우선함)
preg_match("/<embed.*?src=[\"']\/\/www\.youtube\.com\/v\/([^?]+)\?(.*?)['\"]/", $list[$i][wr_content], $matches);
$v = $matches[1];
$thumb="<img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle' width='250' height='300'>";
}elseif (file_exists($thumb)) { // 썸네일이 있다면
$thumb = "<img src='".$thumb."' align='absmiddle'>";
}else{ //썸네일이 없다면
$thumb = "IMAGE NONE";
}
echo "<td width='{$td_width}%' valign=top style='word-break:break-all; padding:0px;'>";
echo "<table align=center>";
echo "<tr><td height=15></td></tr>";
echo "<tr><td align=center><div style='float:left; border:1px solid #ccc; background:#fff; padding:4px; font-size:0; line-height:0;'><a href='{$href}' target='{$target}'>".$thumb."</a></div></td></tr>";
//echo "<tr><td align=center style='font-size:11px; color:#888;'>Date.".$list[$i][datetime2]." / Hit.".$list[$i][wr_hit]."</td></tr>";
echo "<tr><td align=center class=lh>";
if ($is_category) echo "<a href='{$list[$i][ca_name_href]}'>[{$list[$i][ca_name]}]</a> ";
echo "<a href='{$list[$i][href]}'>$subject</a><span class='comment'>{$comment_cnt}</span>";
//echo " " . $list[$i][icon_new];
//echo " " . $list[$i][icon_file];
//echo " " . $list[$i][icon_link];
//echo " " . $list[$i][icon_hot];
//echo " " . $list[$i][icon_secret];
echo "</td></tr>";
if ($is_checkbox) echo "<tr><td align=center><input type=checkbox name=chk_wr_id[] value='{$list[$i][wr_id]}'></td></tr>";
echo "</table></td>\n";
}
// 나머지 td
$cnt = $i%$mod;
if ($cnt)
for ($i=$cnt; $i<$mod; $i++)
echo "<td width='{$td_width}%'> </td>";
?>
</tr>
<? if (count($list) == 0) { echo "<tr><td colspan='$mod' height=100 align=center>게시물이 없습니다.</td></tr>"; } ?>
<tr><td colspan='<?=$mod?>' height='15'></td></tr>
<tr><td colspan=<?=$mod?> bgcolor='#DEE3E7' height='1'>
</table>
</form>
<form name="fboardlist" method="post">
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
<input type='hidden' name='sfl' value='<?=$sfl?>'>
<input type='hidden' name='stx' value='<?=$stx?>'>
<input type='hidden' name='spt' value='<?=$spt?>'>
<input type='hidden' name='page' value='<?=$page?>'>
<input type='hidden' name='sw' value=''>
<table width="100%" cellpadding='0' cellspacing='0'>
<tr><td colspan='<?=$mod?>' height='5'></td></tr>
<tr><td colspan='<?=$mod?>' height='1' bgcolor='#DEE3E7'></td></tr>
<tr>
<?
for ($i=0; $i<count($list); $i++) {
if($list[$i][wr_link1]){
$href = $list[$i][wr_link1];
$target = "_blank";
}else{
$href = $list[$i][href];
$target = "_self";
}
if ($i && $i%$mod==0)
echo "</tr><tr>";
$style = "";
$subject = "<span $style>{$list[$i][subject]}</span>";
$comment_cnt = "";
if ($list[$i][comment_cnt])
$comment_cnt = " <a href=\"{$list[$i][comment_href]}\"><span style='font-size:10px;'><font face='Tahoma' color='#EE5A00'>{$list[$i][comment_cnt]}</span></a>";
$list[$i][name] = preg_replace("/<img /", "<img style='display:none;' ", $list[$i][name]);
$list[$i][name] = preg_replace("/> <span/", "><span", $list[$i][name]);
$list[$i][name] = preg_replace("/class='member'/", "", $list[$i][name]);
$thumb = makeThumbs($g4[path]."/data/file/".$bo_table, $list[$i][file][0][file], $board[bo_1], $board[bo_2], cut_str($list[$i][subject],20));
if (eregi("<embed.*src=\"//www.youtube.com/v/([^&]+)&?",$list[$i][wr_content])) { //오브젝트 유튜브동영상올린경우(썸네일보다 우선함)
preg_match("/<embed.*?src=[\"']\/\/www\.youtube\.com\/v\/([^?]+)\?(.*?)['\"]/", $list[$i][wr_content], $matches);
$v = $matches[1];
$thumb="<img src='http://img.youtube.com/vi/".$v."/hqdefault.jpg' align='absmiddle' width='250' height='300'>";
}elseif (file_exists($thumb)) { // 썸네일이 있다면
$thumb = "<img src='".$thumb."' align='absmiddle'>";
}else{ //썸네일이 없다면
$thumb = "IMAGE NONE";
}
echo "<td width='{$td_width}%' valign=top style='word-break:break-all; padding:0px;'>";
echo "<table align=center>";
echo "<tr><td height=15></td></tr>";
echo "<tr><td align=center><div style='float:left; border:1px solid #ccc; background:#fff; padding:4px; font-size:0; line-height:0;'><a href='{$href}' target='{$target}'>".$thumb."</a></div></td></tr>";
//echo "<tr><td align=center style='font-size:11px; color:#888;'>Date.".$list[$i][datetime2]." / Hit.".$list[$i][wr_hit]."</td></tr>";
echo "<tr><td align=center class=lh>";
if ($is_category) echo "<a href='{$list[$i][ca_name_href]}'>[{$list[$i][ca_name]}]</a> ";
echo "<a href='{$list[$i][href]}'>$subject</a><span class='comment'>{$comment_cnt}</span>";
//echo " " . $list[$i][icon_new];
//echo " " . $list[$i][icon_file];
//echo " " . $list[$i][icon_link];
//echo " " . $list[$i][icon_hot];
//echo " " . $list[$i][icon_secret];
echo "</td></tr>";
if ($is_checkbox) echo "<tr><td align=center><input type=checkbox name=chk_wr_id[] value='{$list[$i][wr_id]}'></td></tr>";
echo "</table></td>\n";
}
// 나머지 td
$cnt = $i%$mod;
if ($cnt)
for ($i=$cnt; $i<$mod; $i++)
echo "<td width='{$td_width}%'> </td>";
?>
</tr>
<? if (count($list) == 0) { echo "<tr><td colspan='$mod' height=100 align=center>게시물이 없습니다.</td></tr>"; } ?>
<tr><td colspan='<?=$mod?>' height='15'></td></tr>
<tr><td colspan=<?=$mod?> bgcolor='#DEE3E7' height='1'>
</table>
</form>
답변을 작성하려면 로그인이 필요합니다.
도무지 모르겠더라구여 어떤분이 아래소스 소개해 줘서 며칠소스보면서 해밨는데 모르겠네요 아래 링크스킨이 좋긴좋더라구여 걍1번링크에 유투뷰 동영상 주소링크만 걸면 메인에 바로 이미지가 출력되드라구여 근데 세로라서 가로로 고쳐볼려고 했는데 그것도 힘들구여 ㅎㅎ 암튼 걍 포기하고 질문 올리고 있어요 ㅎㅎ
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=149256