코

썸네일을 두열로 하고싶은데 도움요청합니다.

· 2012-07-11 (수) 18:17:54 · 1622 · 4
<table cellpadding="0" cellspacing="0" border="0">
<?
$img_width = 99; //썸네일 가로길이
$img_height = 62; //썸네일 세로길이
$img_quality = 100; //퀼리티 100이하로 설정
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/board_thumb'; //썸네일 이미지 생성 디렉토리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
$li = array();
for ($i=0; $i<5; $i++) {
if($list[$i][file][0][file]) {
$file = "<img src='".$list[$i][file][0][path] .'/'. $list[$i][file][0][file]."' align=absmiddle width=\"240\" height=\"188\">";
} else {
$file="";
}

for($j=0; $j<1; $j++) {
@unlink("$thumb_path/{$list[$i][wr_id]}"); //썸네일 리셋
$img = "";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
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);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$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], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb)){
$img = "<img src='$thumb' width='$img_width' height='$img_height' alt='{$list[$i][subject]}'>";
$li[$i] = "$img";
}
if($list[$i][file][$j][image_type] >= 1 && $list[$i][file][$j][image_type] <= 3) {
$list[$i][thumbnail][path] = $list[$i][file][$j][path];
$list[$i][thumbnail][name] = $list[$i][file][$j][file];
$list[$i][thumbnail][content] = $list[$i][file][$j][bf_content];
$list[$i][thumbnail][href] = $list[$i][thumbnail][path]."/".$list[$i][thumbnail][name];
$list[$i][thumbnail][src] = $list[$i][thumbnail][path]."/thumbnail/".$list[$i][thumbnail][name];
if(!is_file($list[$i][thumbnail][src])){
$list[$i][thumbnail][src] = $list[$i][thumbnail][path]."/".$list[$i][thumbnail][name];
// 이미지 비률 수정및 이미지 포멧방식 체크
list($r_width[$i]) = getimagesize($list[$i][thumbnail][src]);
}
break;
}
}
}
for($i=0; $i<5; $i++) { ?>
<tr>
<td class="youTubeList"><?=$li[$i]?></td>
</tr>
<? } ?>
</table>

-----------------------------------------------------------------------------

이부분이 썸네일 부분인데 어디를 복사해야 두열로 나올지.ㅜ (지금은 한열로만 나옵니다.ㅠ)
질문드립니다.ㅜㅠ
|

댓글 4개

2012-07-11 (수) 18:56:44
최신글 이면 최신글 부르는 함수에

가로출력 갯수 있을거고

게시판이면 게시판 설정에 가시면 가로 설정갯수 있습니다.

설정 해도 안되면 게시판 리스트 상단에 소스 먼가 빠졌으니 전체 소스를 올려주시기 바랍니다.
2012-07-11 (수) 19:02:26
당연히 최신글 부르는곳에 불러봤는데 5개만 생성 되더라구요.ㅜㅠ
그래서 계속 소스를 보고있는데 으아 어렵네요.ㅜㅠ
제발 도와주세요 ㅠㅠ
------------------------------------------------------------------------------------
<style>
.youTube {
background:url("<?=$g4['path']?>/imgs/yt_bg.png") no-repeat;
width:777px;
height:388px;
}
.youTubePlay {
position:relative;
margin:auto 0;
overflow:hidden;
width:617px;
height:344px;

}
.player {
position:absolute;
width:617px;
height:344px;
top:0;
}
.playContent {
position:relative;
margin:auto 0;
overflow:hidden;
width:617px;
height:344px;
}
.playInfo {
position:absolute;
z-index:1;
bottom:0px;
width:617px;
height:50px;
background:#000;
filter:alpha(opacity=60);
opacity:0.6;
-moz-opacity:0.6;

}
.playText {
margin-top:10px;
font-weight:bold;
color:#fff;
text-align:center;
}
.youTubeList img {
border:5px solid #fff;
cursor:pointer;
}


</style>

<table cellpadding="0" cellspacing="0" border="0" class="youTube png">
<tr>
<td align=""><div class="youTubePlay">
<? for($i=0; $i<5; $i++) { ?>
<div class="player player<?=$i?>">
<div class="playContent">
<div class="playInfo">
<p class="playText"><?=$list[$i]['subject']?></p>
</div>
<a href="<?=$list[$i]['href']?>"><img src="<?=$list[$i]['file'][0]['path']?>/<?=$list[$i]['file'][0]['file']?>" width="617" height="344" /></a>
</div>
</div>
<? } ?>
</div></td>
<td><table cellpadding="0" cellspacing="0" border="0">
<?
$img_width = 99; //썸네일 가로길이
$img_height = 62; //썸네일 세로길이
$img_quality = 100; //퀼리티 100이하로 설정
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/board_thumb'; //썸네일 이미지 생성 디렉토리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
$li = array();
for ($i=0; $i<5; $i++) {
if($list[$i][file][0][file]) {
$file = "<img src='".$list[$i][file][0][path] .'/'. $list[$i][file][0][file]."' align=absmiddle width=\"240\" height=\"188\">";
} else {
$file="";
}

for($j=0; $j<1; $j++) {
@unlink("$thumb_path/{$list[$i][wr_id]}"); //썸네일 리셋
$img = "";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
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);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$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], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb)){
$img = "<img src='$thumb' width='$img_width' height='$img_height' alt='{$list[$i][subject]}'>";
$li[$i] = "$img";
}
if($list[$i][file][$j][image_type] >= 1 && $list[$i][file][$j][image_type] <= 3) {
$list[$i][thumbnail][path] = $list[$i][file][$j][path];
$list[$i][thumbnail][name] = $list[$i][file][$j][file];
$list[$i][thumbnail][content] = $list[$i][file][$j][bf_content];
$list[$i][thumbnail][href] = $list[$i][thumbnail][path]."/".$list[$i][thumbnail][name];
$list[$i][thumbnail][src] = $list[$i][thumbnail][path]."/thumbnail/".$list[$i][thumbnail][name];
if(!is_file($list[$i][thumbnail][src])){
$list[$i][thumbnail][src] = $list[$i][thumbnail][path]."/".$list[$i][thumbnail][name];
// 이미지 비률 수정및 이미지 포멧방식 체크
list($r_width[$i]) = getimagesize($list[$i][thumbnail][src]);
}
break;
}
}
}
for($i=0; $i<5; $i++) { ?>
<tr>
<td class="youTubeList"><?=$li[$i]?></td>
</tr>
<? } ?>
</table></td>
</tr>
</table>
<script>
$(".youTubeList > img").hover(
function() {
if($(this).index() == ytCurIdx) {
return;
}
$(this).css({"border-color":"gray"});
},
function() {
if($(this).index() == ytCurIdx) {
return;
}
$(this).css({"border-color":"#fff"});
}
);
var ytCur;
var ytCurIdx;
var ytIdx;
var ytBf;
$(".youTubeList > img").each(function(index) {
if(index==0) {
ytBf = $(".player"+index).show();

ytCur = $(this).css({"border-color":"gray"});
ytCurIdx = ytCur.index();
} else {
$(".player"+index).css({top:344*index});
}
$(this).mouseover(function() {
ytIdx = $(".player"+index);
if(ytBf.index() == ytIdx.index()) {
return;
} else {
$(".youTubePlay").children().each(function(idx){
$(this).stop(true).animate({top:344*(idx-index)},1000);
});
ytBf = $(".player"+index);

ytCur.css({"border-color":"#fff"});
ytCur = $(this).css({"border-color":"gray"});
ytCurIdx = ytCur.index();
}
}).click(function() {youTube($(".player"+index)); });
});
$(".player").each(function(index) {
$(this).mouseover(function() {
if($(this).find(".playInfo").is(":visible")) {
return;
} else {
youTube($(this));
}
});
});
function youTube($obj) {
$obj.find(".playInfo").slideToggle('slow');
}
</script>
<? for($i=0; $i<5; $i++) {
$i<5 ==> 얘 숫자를 변경해보세요. 군데... 두줄로 나올지는 모르겠네요..
2012-07-12 (목) 00:09:45
감사합니다!
두줄은 아니지만 사진을 더 넣을수 있습니다아!!
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

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

+
제목 글쓴이 날짜 조회
12-07-12 조회 892
12-07-12 조회 756
12-07-12 조회 819
12-07-12 조회 1,043
12-07-12 조회 640
12-07-12 조회 1,082
12-07-12 조회 1,649
12-07-12 조회 958
12-07-12 조회 1,624
12-07-11 조회 835
12-07-11 조회 811
12-07-11 조회 2,632
12-07-11 조회 896
12-07-11 조회 814
12-07-11 조회 945
12-07-11 조회 1,535
12-07-11 조회 1,057
12-07-11 조회 2,049
12-07-11 조회 1,623
12-07-11 조회 1,053