이미지 불러오기

이미지 불러오기

QA

이미지 불러오기

본문

background-image:url 이건 폴더를 만들어 폴더안에 이미지를 보여지게하는건데 이걸 갤러리게시판 리스트에 올라온걸 보이게 할려고하는데 에러가 뜨네요... 이 소스 자체가 리스트에있는건 불러오게할수없는건가요?

 

$path = "./image"; 

<div class="swiper-slide" style="background-image:url(./image/<?=$img?>)"></div>

foreach($entrys as $img){

 

 

<div class="swiper-slide" style="background-image:url(<?php  echo latest("basic", "trendbook", 1000, 25) ?>)"></div>

최근걸 보여주는걸로 해봤는데.. 이것도 에러뜨네요..

 

 
 
<? 
$path = " http://1111.co.kr/board/bbs/board.php?bo_table=trendbook";  
$entrys = array(); 
$dirs = dir($path); 
while(false !== ($entry = $dirs->read())){ 
if(($entry != '.') && ($entry != '..')) {  
if(!is_dir($path.'/'.$entry)) { 
     $entrys[] = $entry;   
}   
}   
}   
$dirs->close(); 
?> 
        <!-- Add Arrows -->
<div class="swiper-button-next swiper-button-white"></div>
 <div class="swiper-button-prev swiper-button-white"></div>
 <div class="swiper-container gallery-thumbs">
        <div class="swiper-wrapper">
  <? 
foreach($entrys as $echo "http://1111.co.kr/board/bbs/board.php?bo_table=trendbook"){ 
?> 
<div class="swiper-slide" style="background-image:url( 
http://1111.co.kr/board/bbs/board.php?bo_table=trendbook)"></div>
<?  
} 
?> 
</div>
</div> 
 <script>
    var galleryTop = new Swiper('.gallery-top', {
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        spaceBetween: 10,
        loop:true,
        loopedSlides: 5, //looped slides should be the same     
    });
    var galleryThumbs = new Swiper('.gallery-thumbs', {
        spaceBetween: 10,
        slidesPerView: 4,
        touchRatio: 0.2,
        loop:true,
        loopedSlides: 5, //looped slides should be the same
        slideToClickedSlide: true
    });
    galleryTop.params.control = galleryThumbs;
    galleryThumbs.params.control = galleryTop;
    
    </script> 
 

이 질문에 댓글 쓰기 :

답변 2

폴더 경로가 맞지않아서 나오는 에러 입니다

답변글은 root에 소스가 있을때 예제 입니다

화일 위치에 따라 경로를 맞게 넣어야 합니다

그누보드 상에서 사용이라면 그냥 아래처럼 해주면 됩니다

$path=G5_DATA_PATH."/file/find";

 

 

1. 4번행 처럼 사이트 주소로는 6번, 8번행 같은 함수가 작동하지않습니다

2. path는 이미지가 저장되는 폴더명을 사용해야지 저렇게 게시판 링크를 넣어서는 안됩니다

그누보드 게시판 이미지 저장 위치를 아래와 같은 방법으로 경로를 넣어줍니다

$path="./data/file/게시판아이디";

3. 22행 foreach 문은 완전 엉터리 입니다

foreach($entrys as $vv){
?>
<div class="swiper-slide" style="background-image:url(<?=$path?>/<?=$vv?>);"></div> 

신경써주셔서 감사합니다^^;; 이런식으로했는데 밑에 처럼 에러가 뜨네요...
find 이라는 폴더안에 index.php파일이 들어있던데 이것때문인가요?
Dir은...

$path="./data/file/find"; 
$entrys = array();
$dirs = dir($path);
while(false !== ($entry = $dirs->read())){
if(($entry != '.') && ($entry != '..')) { 
if(!is_dir($path.'/'.$entry)) {
    $entrys[] = $entry; 




$dirs->close();
?>

        <!-- Add Arrows -->
<div class="swiper-button-next swiper-button-white"></div>
 <div class="swiper-button-prev swiper-button-white"></div>
 <div class="swiper-container gallery-thumbs">
        <div class="swiper-wrapper">
<?
foreach($entrys as $vv){
?>
<div class="swiper-slide" style="background-image:url(<?=$path?>/<?=$vv?>);"></div>
<? 
}
?>
</div>
</div>

Warning: dir(./data/file/find) [function.dir]: failed to open dir: No such file or directory in /home/tnhands/public_html/index.php on line 288

Fatal error: Call to a member function read() on a non-object in /home/tnhands/public_html/index.php on line 289

답변을 작성하시기 전에 로그인 해주세요.
전체 299
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT