그누보드 최신글 첨부파일 슬라이드관련 질문드립니다. 채택완료
이름없음55
3년 전
조회 3,700
안녕하세요?
최신글 추출에서
이미지 에디터말고 첨부파일을 첨부한대로 이미지가 전부 다 나와서 슬라이드로 만들고 싶은데요.
</p>
<p><?php</p>
<p>if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');</p>
<p>// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 10);</p>
<p>
$sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' ";
$result = sql_query($sql);
$row=sql_fetch_array($result);</p>
<p>if ($row['bo_gallery_width'] == 0){
$thumb_width = $row['bo_gallery_height'];
} else {
$thumb_width = $row['bo_gallery_width'];
}
if ($row['bo_gallery_height'] == 0){
$thumb_height = $row['bo_gallery_width'];
} else {
$thumb_height = $row['bo_gallery_height'];
}
?></p>
<p>
<?php
for ($i=0; $i<count($list); $i++) {
$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
$youtubeID = $list[$i]['wr_link1'];
$youtubeID = explode('/',$youtubeID); </p>
<p> if($thumb['src']) {
$img = $thumb['src'];
$thumb['alt'] = $list[$i]['subject'];
$noImage = '';
$youtube_content = '';
} else {
if($youtubeID[2] == "youtu.be") {
$youtube_content = '<sup class="youtube_img" style="background-image:URL(<a href="https://img.youtube.com/vi/'.$youtubeID[3].'/sddefault.jpg"" target="_blank" rel="noopener noreferrer">https://img.youtube.com/vi/'.$youtubeID[3].'/sddefault.jpg"</a> alt="'.$list[$i]['subject'].');"></sup>
';
}
$thumb['alt'] = 'No image';
$noImage = '<u>No image</u>';
}
$img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
?></p>
<p> <div class="test_wrap_list">
<div class="test_slider">
<div class="test_list">
<img src="<?php echo $img?>">
</div>
</div>
<div class="test_direction">
<div class="page_info "></div>
</div>
</div></p>
<p> <?php } ?></p>
<p> <?php if (count($list) == 0) { //게시물이 없을 때 ?>
<?php } ?>
</p>
<p>
저기 .test_list 부분이 이미지 나오는곳인데 어떻게 수정해야 첫번째 첨부파일말고,
이미지 첨부한대로 전부 나올수있게 할지 잘모르겠습니다 ㅠㅠㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
3년 전
</p>
<p><?php</p>
<pre>
<code>for ($i=0; $i<count($list); $i++) {
...코드
$this_file = get_file($bo_table, $list[$i]['wr_id'];
print_r ($this_file);</code><code>
...코드
}</code></pre>
<p>?></p>
<p>
print_r ($this_file); 이 값이 제대로 찍혀 나온다면 배열에서 필요한 것들만 가져가시면 됩니다.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 3개
�
이름없음55
3년 전
아르키어드님 친절한 답변감사드립니다! 근데 ...코드가 위아래 잇는데 어디다 넣어야하나요?
�
아르키어드
3년 전
[code]
<?php
for ($i=0; $i<count($list); $i++) {
$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
$youtubeID = $list[$i]['wr_link1'];
$youtubeID = explode('/',$youtubeID);
if($thumb['src']) {
$img = $thumb['src'];
$thumb['alt'] = $list[$i]['subject'];
$noImage = '';
$youtube_content = '';
} else {
if($youtubeID[2] == "youtu.be") {
$youtube_content = '<sup class="youtube_img" style="background-image:URL(https://img.youtube.com/vi/'.$youtubeID[3].'/sddefault.jpg" alt="'.$list[$i]['subject'].');"></sup>
';
}
$thumb['alt'] = 'No image';
$noImage = '<u>No image</u>';
}
$img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
// 여기서 들어갑니다.
$this_file = get_file($bo_table, $list[$i]['wr_id'];
print_r ($this_file);
?>
<div class="test_wrap_list">
<div class="test_slider">
<div class="test_list">
<img src="<?php echo $img?>">
</div>
</div>
<div class="test_direction">
<div class="page_info "></div>
</div>
</div>
<?php } ?>
<?php if (count($list) == 0) { //게시물이 없을 때 ?>
<?php } ?>
[/code]
다만 지금 .test_list 안에 print_r 로 찍은 $this_file 배열 안에 있는 이미지들을 넣으실거면 썸네일 부르는 코드들은 삭제하시고 test_list를 반복문으로 한번 더 돌리셔야됩니다.
<?php
for ($i=0; $i<count($list); $i++) {
$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
$youtubeID = $list[$i]['wr_link1'];
$youtubeID = explode('/',$youtubeID);
if($thumb['src']) {
$img = $thumb['src'];
$thumb['alt'] = $list[$i]['subject'];
$noImage = '';
$youtube_content = '';
} else {
if($youtubeID[2] == "youtu.be") {
$youtube_content = '<sup class="youtube_img" style="background-image:URL(https://img.youtube.com/vi/'.$youtubeID[3].'/sddefault.jpg" alt="'.$list[$i]['subject'].');"></sup>
';
}
$thumb['alt'] = 'No image';
$noImage = '<u>No image</u>';
}
$img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
// 여기서 들어갑니다.
$this_file = get_file($bo_table, $list[$i]['wr_id'];
print_r ($this_file);
?>
<div class="test_wrap_list">
<div class="test_slider">
<div class="test_list">
<img src="<?php echo $img?>">
</div>
</div>
<div class="test_direction">
<div class="page_info "></div>
</div>
</div>
<?php } ?>
<?php if (count($list) == 0) { //게시물이 없을 때 ?>
<?php } ?>
[/code]
다만 지금 .test_list 안에 print_r 로 찍은 $this_file 배열 안에 있는 이미지들을 넣으실거면 썸네일 부르는 코드들은 삭제하시고 test_list를 반복문으로 한번 더 돌리셔야됩니다.
�
이름없음55
3년 전
제가 그누보드 초보라서 아직 많이 부족해서 어디에 어떻게 넣고 어디를 바꾸고 그런거를 잘모르겠네요 ㅠㅠ 그래도 친절한 답변 정말 감사드립니다!!
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인