글쓸때 첨부한 3번째 이미지파일 최신글에 불러오는 방법좀요 정보
글쓸때 첨부한 3번째 이미지파일 최신글에 불러오는 방법좀요본문
첨부파일에 첨부된
$file01
$file02
$file03
파일중 01,02파일은 불러와서 작동되는데
$file03파일을 불러와서
<div id="fragment-<?=$j?>" class="ui-tabs-panel <?=$hide?>">....</div>배경으로 넣어서
같이 이미지 전환되게 하려고 하는데요
어떻게 수정해야 하나요.
=================================================================================================
<div id="featured" ><div id="featured1">
<ul class="ui-tabs-nav">
<?
for ($i=0; $i<count($list); $i++) {
$file01 = "$data_path/".urlencode($list[$i][file][0][file]);
$file02 = "$data_path/".urlencode($list[$i][file][1][file]);
$file03 = "$data_path/".urlencode($list[$i][file][2][file]);
$link_01 = $list[$i][wr_link1];
$j = $i + 1;
if ($j == "1") {
$selected='ui-tabs-selected';
} else {
$selected='';}
//썸네일 생성
$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 = "$thumb";
else
//이미지가 없으면
$thumfile="$latest_skin_path/img/noimg.gif";
//이미지가 아니네
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>"; }
?>
<li class="ui-tabs-nav-item <?=$selected?>" id="nav-fragment-<?=$j?>"><a href="#fragment-<?=$j?>"><img src="<?=$file02?>" alt="" width="80" height="50" /></a></li>
<? }?>
</ul></div>
<!-- First Content -->
<?
for ($i=0; $i<count($list); $i++) {
$file01 = $thumb_path.'/'.$list[$i][wr_id];
$j = $i + 1;
if ($j == "1") {
$hide='';
} else {
$hide='ui-tabs-hide'; }
?>
▼이부분에 첨부된 03파일 불러오고싶어서요
<div id="fragment-<?=$j?>" class="ui-tabs-panel <?=$hide?>"><div style="width: 940px; height: 300px; margin:0 auto; position: relative; background-color: #9C0;">
<a href='<?=$link_01?>'><img src="<?=$file01?>" alt="" /></a>
</div></div>
<? }?>
</div>
</div>
=======================================================
스타일은 어떤식으로 줘야 하는지..
#featured .ui-tabs-panel{
width:100%;
height:300px;
position:relative;
background-color: #FF6600;
background-image: url(<?=$file03?>);
background-repeat: repeat-x;
}
$file01
$file02
$file03
파일중 01,02파일은 불러와서 작동되는데
$file03파일을 불러와서
<div id="fragment-<?=$j?>" class="ui-tabs-panel <?=$hide?>">....</div>배경으로 넣어서
같이 이미지 전환되게 하려고 하는데요
어떻게 수정해야 하나요.
=================================================================================================
<div id="featured" ><div id="featured1">
<ul class="ui-tabs-nav">
<?
for ($i=0; $i<count($list); $i++) {
$file01 = "$data_path/".urlencode($list[$i][file][0][file]);
$file02 = "$data_path/".urlencode($list[$i][file][1][file]);
$file03 = "$data_path/".urlencode($list[$i][file][2][file]);
$link_01 = $list[$i][wr_link1];
$j = $i + 1;
if ($j == "1") {
$selected='ui-tabs-selected';
} else {
$selected='';}
//썸네일 생성
$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 = "$thumb";
else
//이미지가 없으면
$thumfile="$latest_skin_path/img/noimg.gif";
//이미지가 아니네
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>"; }
?>
<li class="ui-tabs-nav-item <?=$selected?>" id="nav-fragment-<?=$j?>"><a href="#fragment-<?=$j?>"><img src="<?=$file02?>" alt="" width="80" height="50" /></a></li>
<? }?>
</ul></div>
<!-- First Content -->
<?
for ($i=0; $i<count($list); $i++) {
$file01 = $thumb_path.'/'.$list[$i][wr_id];
$j = $i + 1;
if ($j == "1") {
$hide='';
} else {
$hide='ui-tabs-hide'; }
?>
▼이부분에 첨부된 03파일 불러오고싶어서요
<div id="fragment-<?=$j?>" class="ui-tabs-panel <?=$hide?>"><div style="width: 940px; height: 300px; margin:0 auto; position: relative; background-color: #9C0;">
<a href='<?=$link_01?>'><img src="<?=$file01?>" alt="" /></a>
</div></div>
<? }?>
</div>
</div>
=======================================================
스타일은 어떤식으로 줘야 하는지..
#featured .ui-tabs-panel{
width:100%;
height:300px;
position:relative;
background-color: #FF6600;
background-image: url(<?=$file03?>);
background-repeat: repeat-x;
}
댓글 전체
ui-tabs-panel 이 css 클래스 안에다가 background:url(이미지경로) repeat-no; 주시면 됩니다.
다만 whith와 height 고려해서 보시면 되겠습니다.
다만 whith와 height 고려해서 보시면 되겠습니다.
첨부파일의 세번째 파일은 $list[$i]['file'][2]['file'] 가 세번째 파일입니다
첨부파일은 $list[$i]['file'][0] 부터 시작해서 첨부한 파일의 -1 만큼이지요
즉, 3개의 첨부파일이면 0, 1, 2 로 해서 2번이 3번째 파일이 됩니다
첨부파일은 $list[$i]['file'][0] 부터 시작해서 첨부한 파일의 -1 만큼이지요
즉, 3개의 첨부파일이면 0, 1, 2 로 해서 2번이 3번째 파일이 됩니다