스크립트문 도움좀 부탁드려요^!^

· 2013-02-22 (금) 20:11:43 · 810 · 3
이미지 2.png
<!--
old_debate_P='1';
function ComeonP(objid_P){
document.getElementById("debate_P"+old_debate_P).style.display="none";
document.getElementById("debate_P"+old_debate_P+"#1").style.display="";
document.getElementById("debate_P"+objid_P+"#1").style.display="none";
document.getElementById("debate_P"+objid_P).style.display="";
document.getElementById("debate_content_P"+old_debate_P).style.display="none";
document.getElementById("debate_content_P"+objid_P).style.display="";
old_debate_P=objid_P;
}
var objid_P = 1;
var interval_best;

function best_changeP()
{
if( objid_P == <?=count($list)?> ) // 오버랩되는 갯수
objid_P = 1;
else
objid_P++;

ComeonP(objid_P);
}
function setInterval_best()
{
interval_best = setInterval("best_changeP()",5000);//속도조절
}
function clearInterval_best()
{
clearInterval(interval_best);
}
setInterval_best();
//-->
</SCRIPT>


작은 오버랩시 변경되는 썸네일을 3개만 출력하고자합니다

썸네일 부분입니다

<? for ($i=0; $i<count($list); $i++) {
$k = $i + 1;
$img_width_s = 85; //작은 썸네일 가로
$img_height_s = 85; //작은 썸네일 세로
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
//썸네일 생성
$thumfile = "";
$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);
} else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
$edit_img = $list[$i]['wr_content'];
if (eregi("data/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // data/geditor------
$file = './' . $tmp[0]; // 파일명
$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))
$thumfile = "<img src='$thumb' width='{$img_width}' height='{$img_height}' border='0' style='border:0px #ccc solid'></a>";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/no-image.gif' width='{$img_width}' height='{$img_height}' style='border:0 #E7E7E7 solid'></a>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?>

첨부파일

이미지 2.png (163.3 KB)
0회 2013-02-22 20:11
|

댓글 3개

2013-02-22 (금) 20:16:10
function best_changeP()
{
if( objid_P == <?=count($list)?> ) // 오버랩되는 갯수
objid_P = 1;
else
objid_P++;

ComeonP(objid_P);
}
요기 <?=count($list)?> 값이 3으로 바꾸시고

<? for ($i=0; $i<count($list); $i++) {
$k = $i + 1;
$img_width_s = 85; //작은 썸네일 가로
$img_height_s = 85; //작은 썸네일 세로

여기서 count($list) 값에 따라서 변하니까 이걸그냥 숫자 3으로 바꾸시면 세개만 뜰득
2013-02-22 (금) 20:35:24
아하 오버랩되는 갯수에는 컨텐츠 리스트 함수를 따르지만

썸네일을 지정한 아래 설명주신부분을 그냥 3으로 해주니 되네요 ㅎㅎ

왜 위에 스크립트에서만 찾았찌 ㅠ_ㅠ 고수는 틀리네용 여성분이면 이쁘십니다!
2013-02-22 (금) 20:18:12
아니면 이 페이지를 불러들이는 함수에서 3으로 설정하면 3개만 나오겠지요!!
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

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

+
제목 글쓴이 날짜 조회
13-02-23 조회 1,783
13-02-23 조회 805
13-02-23 조회 1,542
13-02-22 조회 841
13-02-22 조회 895
13-02-22 조회 1,722
13-02-22 조회 1,652
13-02-22 조회 1,772
13-02-22 조회 2,240
13-02-22 조회 811
13-02-22 조회 1,125
13-02-22 조회 1,606
13-02-22 조회 861
13-02-22 조회 1,802
13-02-22 조회 3,456
13-02-22 조회 1,692
13-02-22 조회 893
13-02-22 조회 1,038
13-02-22 조회 2,893
13-02-22 조회 1,776